title: Javascript find average from user's input
body: <p>I know there are similar questions on here to mine but I don't see the answer there.</p>
  
  <p>Where am I going wrong with this JS code to find the average number from the user's input?
  I want to keep entering numbers until -1 is entered. I think -1 is being counted as an input/</p>
  
  <pre><code>    var count = 0;
      var input;
      var sum = 0;
  
          while(input != -1){
              input = parseInt(prompt("Enter a number"));
              count++;
              sum = sum + input;
              sum = parseInt(sum);
              average = parseFloat(sum/count);
          }
  
      alert("Average number is " + average);
  </code></pre>