How can I pass variables by reference to setInterval's call back function?
I don't want to define a global variable just for the counter. Is it possible?
var intervalID;
function Test(){
var value = 50;
intervalID = setInterval(function(){Inc(value);}, 1000);
}
function Inc(value){
if (value > 100)
clearInterval(intervalID);
value = value + 10;
}
Test();