title: Javascript program to print a number series in reverse
body: <p>I don't understand why the below JavaScript program returns the answer Infinity. What am I doing wrong? I'm a novice, and would appreciate a detailed explanation!</p>
  
  <p>Please note that this needs to be accomplished using only math and math functions, no string functions or arrays!</p>
  
  <pre><code>&lt;script type = "text/javascript"&gt;
  
  var input;
  var rev = 0;
  
  input=window.prompt ("Please enter a 5-digit number to be reversed.");
  
  input = input * 1;
  
  while (input &gt; 0)
  {
     rev *= 10;
     rev += input % 10;
     input /= 10;
  }
  document.write ("Reversed number: " + rev);
  
  &lt;/script&gt;
  </code></pre>