title: How to set variable back to 0?
body: <p>How do I set a variable back to 0 in javascript? There are two variables - x and y (x is 3 and y is 1 if that helps at all) Variable x and y in my code are supposed to go back to 0. I tried x = 0 and y = 0 but that didn't work, so how do I do this? This is the top javascript code...</p>
  
  <pre><code>var y=1
  var x=3
  function stickAmount()
  {
  var stickNo = document.getElementById("stickNumber");
  stickNo.innerHTML = "Sticks: "+y;
  y++ 
  }
  
  function rockAmount()
  {
  var rockNo = document.getElementById("rockNumber");
  rockNo.innerHTML = "Rocks: "+x;
  x++
  }
  </code></pre>
  
  <p>and I have a function with what I've been trying to do...</p>
  
  <pre><code>function ten()
  {
  x = 0;
  y = 0;
  
  var elem = document.getElementById("btnOne");
  if (elem.innerHTML=="Feel around the cave") elem.innerHTML = "See around the cave";
  else elem.innerHTML = "Feel around the cave";
  }
  </code></pre>