title: play through an array of audio files onclick
body: <p>I have an array of audio files that I want to play through whenever I click a button. If I click said button, it will play the next audio file in the array. Also, if audio is currently playing when the user clicks again, the current track is reset and the next song plays.</p>
  
  <p>Trying to figure out why I can't cycle through the array I currently have.</p>
  
  <pre><code> var song1 = $("#sound-1");
   var song2 = $("#sound-2");
   var song3 = $("#sound-3");
   var song4 = $("#sound-4");
   var song5 = $("#sound-5");
   var song6 = $("#sound-6");
   var song7 = $("#sound-7");
   var song8 = $("#sound-8");
  
   var audioArray = [ song1, song2, song3, song4, song5, song6, song7, song8 ];
  
  
  $(".click").click(function(){
     var i=0;
        if (i&lt; audioArray.length){
           audioArray[i].trigger('play');
           i++;
        } else if ( i&gt;audioArray.length){
           i = 0;
           audioArray[i].trigger('play');
        };
   });
  </code></pre>