var objects = [
{id: 1},
{id: 2},
{id: 3},
{id: 4}
];
function runMe(a, b) {
return Object.is(a, b);
}
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random
function getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min)) + min; //The maximum is exclusive and the minimum is inclusive
}
function getRandomItem() {
return objects[getRandomInt(0, objects.length)];
}
var a = getRandomItem();
var b = getRandomItem();
function call(runMe, a, b) {
return runMe(a, b);
}
call(runMe, a, b);
var a = getRandomItem();
var b = getRandomItem();
function call(runMe, a, b) {
return runMe.someProp ? runMe.someProp(null, a, b) : runMe(a, b);
}
call(runMe, a, b);