title: Calling setTimeout in a loop not working as expected
body: <p>The following JavaScript ought to (in my mind) play a sequence of notes 0.5 sec apart. But it plays them all as a single simultaneous chord. Any idea how to fix it?</p>
  
  <pre><code>function playRecording() {
      if (notes.length &gt; 0) {
          for (var i = 0; i &lt; notes.length; i++) {
              var timeToStartNote = 500 * i;
              setTimeout(playNote(i), timeToStartNote);
          }
      }
  }
  
  function playNote(i) {
      var noteNumber = notes[i];
      var note = new Audio("/notes/note_" + noteNumber + ".mp3");
      note.play();
  }
  </code></pre>