title: Integer validation not working as expected
body: <p>Thanks to some of the answers on this site, I built a function to validate an integer inside a prompt in javascript. I found out how to use <code>isNaN</code> and the result of <code>%</code> in order to meet my needs, but there must be something wrong, because is still not working: This function for validation needs to accept only integers, and as extra bonus, it will also accept a special keyword used for a different purpose later on in the program. </p>
  
  <p>So, previously I had defined: </p>
  
  <pre><code>var value = prompt("Type an integer");
  </code></pre>
  
  <p>So after that, I made a call for the validation function, and that included three conditions: The validation warning would jump if:</p>
  
  <p>1) The string is not a number</p>
  
  <p>2) The string % 1 is not 0 (means is not an integer)</p>
  
  <p>3) The string is not the special keyword ("extra") which is also valid as input.</p>
  
  <p>The function needs to loop and keep showing the prompt until a valid data is written.</p>
  
  <pre><code>while (isNaN(value) == true &amp;&amp; value % 1 != 0 &amp;&amp; value != "extra") {
      alert("Please, type an integer");
      var value = prompt("Type an integer");
  }
  </code></pre>
  
  <p>What am I doing wrong? Thank you so much for any ideas. I know the integer validation has been asked many times here, and here I got a few ideas, but I might be missing something...</p>