title: Using a variable with changing value in setTimeout function approach?
body: <p>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. </p>
  
  <pre><code>for(var jj = 0; jj&lt;monster.frames.length;jj++){
      setTimeout(
          functionName(jj),
          1000*jj
      );
  }
  </code></pre>
  
  <p>The problem is that when that when <code>functionName(jj)</code> is exectuted, it's being passed the value of <code>jj</code> which by that time has been changed to the last loop iteration value. </p>