title: using a for loop in javascript write a code that prompts the user to enter any amount of numbers the print the largest and smallest of those numbers
body: <p>new to JS, here's the problem, code to ask user to enter any amount of numbers -1 to end, find and display the largest and smallest; it's working except that it displays the smallest as the largest but the largest displays 
  fine??</p>
  
  <pre><code>    var numInputs = parseInt(prompt("Please enter numbers seperated by
        a space end with -1"))
      var largestNum =0;
      var smallestNum = 9999;
  
  
  if (numInputs &gt;0)
  {
    for (i=1; i&lt;=numInputs; i++)
    {
  
  if (numInputs &gt; largestNum)
  {
     largestNum = numInputs;
  }
    }
  }
  alert("The largest number entered was " + largestNum);
  
  if (numInputs &gt;0)
  {
    for (i=1; i&lt;=numInputs; i++)
    {
  
      if (numInputs &lt; smallestNum)
      {
     smallestNum = numInputs;
      }
    }
  }
  
  alert("The smallest number entered was " + smallestNum);
  </code></pre>