I would like to do something like the below code. Obviously this doesn’t work as this does not allow you to pass in variable, which in the case below, is min and max.
Is it at all possible to do so? And if so, how?
Thanks.
J.
var utils = (function() {
function randomRange(min, max) {
return ((Math.random() * (max - min)) + min);
};
return {
randomRange : randomRange(min, max);
};
}());
utils.randomRangeRound(20,5);
If what you want is so that this will work:
then, you can do this:
Or, if you have multiple methods on the
utilsobject assigned in different places in your code: