title: How to check if a variable is an integer in JavaScript?
body: <p>How do I check if a variable is an integer in JavaScript, and throw an alert if it isn't?  I tried this, but it doesn't work:</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;script type="text/javascript"&gt;
              var data = 22;
              alert(NaN(data));
          &lt;/script&gt;
      &lt;/head&gt;
  &lt;/html&gt;
  </code></pre>