title: Playing audio files in javascript
body: <p>I have many small audio files, and I want to play these files one after another, not all of them at the same time. I have used the object Audio in javascript like this</p>
  
  <pre><code>var audio_1 = new Audio();
  var audio_2 = new Audio();
  var audio_3 = new Audio();
  
  audio_1.src = "/path1";
  audio_2.src = "/path2";
  audio_3.src = "/path3";
  </code></pre>
  
  <p>Now I just need to call the function <code>play</code> for every object, but I need to play the <code>audio_1</code> alone, and play <code>audio_2</code> when the first one ended.</p>
  
  <p>The solution I found is to test on the property <code>ended</code> of every object</p>
  
  <pre><code> audio_1.ended; // returns true when it ends playing
  </code></pre>
  
  <p>I found an object <code>onended</code> inside the audio object, I thought it's a function but it's not, can someone help me and give me the best way to solve this problem.</p>