title: Javascript method pause() only works with audio element
body: <p>So I have a function like this:</p>
  
  <pre><code>function music(song) {
  var audio = new Audio("audio/" + song + ".ogg");
  audio.play();
  }
  </code></pre>
  
  <p>And the problem I'm having is that audio.play() works perfectly, but if I try audio.pause() later (after defining the same variable), it doesn't work. However, if I do this:</p>
  
  <pre><code>function music() {
  var audio = document.getElementById("songname");
  audio.play();
  }
  </code></pre>
  
  <p>Then I can define the variable and later use audio.pause() to pause the track. The problem is that I want to do this within javascript because I have a lot of tracks and I don't want to create audio elements for each one.</p>
  
  <p>Why doesn't the first piece of code allow me to pause the audio later? Is there any way I can let it pause the audio later? If not, are there any alternatives that involve playing the audio from javascript by passing a parameter which is the song title? I don't want to have to include the src in the html.</p>
  
  <p>I suspect that jQuery might have an easy solution for this but form what I've researched I couldn't find anything.</p>