title: How do I loop through a javascript array of audio files?
body: <p>I have a small question about using an array containing Audio-sources (links) in a for loop.</p>
  
  <p>This is my code, basically:</p>
  
  <pre><code>    var audio = new Audio();
      var playlist = new Array('sounds/song0.m4a', 'sounds/song1.m4a', 'sounds/song2.m4a');
  
          for (var i = 0; i &lt;= playlist.length; i++){
      audio.src = (playlist[i]);
      audio.volume = 0.3;
      audio.loop = false;
      if (audio.ended = true)
          i++;
  
      if (i = 2) {
          i = 0;
      }
  </code></pre>
  
  <p>My console gives me an error on the audio.src = (playlist[i]); . Anyone knows how to solve this?</p>