36
Let's say I have something like
function animate(param)
{
// ...
if (param < 10)
setTimeout(function () { animate(param + 1) }, 100);
}
animate(0);
Does this mean each instance of the function's local data will be held in memory until animate completes, i.e. until param reaches 10?
If it's true that instances are held in memory, is there a better way of doing this? I know, passing textual code to setTimeout() solves the problem but in my case there are objects among function arguments that can't be represented as strings easily.