Please let me know if I'm coming at this block on a wrong angle. I have a series of functions I'd like to fire off, and I'd like to be able to set them all up in a loop.
for(var jj = 0; jj<monster.frames.length;jj++){
setTimeout(
functionName(jj),
1000*jj
);
}
The problem is that when that when functionName(jj)
is exectuted, it's being passed the value of jj
which by that time has been changed to the last loop iteration value.