title: How to clear the contents of an Array in javascript by clicking a button?
body: <p>I have a number of buttons that when clicked add a word to an array. This array is used in the url name to download a file:</p>
  
  <pre><code> &lt;button id="button9" onclick="myFunction7();"&lt;/button&gt;
  
   &lt;script&gt;
   var a = []; 
   function myFunction7() { 
   a.push("h"); 
   }
  
   &lt;button id="button10" onclick="myFunction8();"&lt;/button&gt;
  
   &lt;script&gt;
   var b = []; 
   function myFunction8() { 
   b.push("h"); 
   } 
  
  
   var url = [a,b,c,d];
  </code></pre>
  
  <p>(I have just included two buttons, they also exist for c, d in same format) </p>
  
  <p>The function for the buttons works and correct file is loaded. Is there a way to reset the url variable and empty the array? I would like to have a button that resets the url variable on my webpage so a new array can be created. I have created a button that refreshes the entire page but this is not ideal as each time my web page has to re load just to clear the array!</p>