title: Javascript - check if string can be converted to integer?
body: <p>How can I simply check if string can be converted to integer?</p>
  
  <p>And I mean only integer, so string like <code>'10.1'</code> would not be converted to <code>10</code>.</p>
  
  <p>For example if I do:</p>
  
  <pre><code>parseInt('10.1', 10)
  </code></pre>
  
  <p>It returns 10</p>
  
  <p>Is there something equivalent like it is in Python, so I would not need to do lots of checks?</p>
  
  <p>In Python if I do <code>int('10.1')</code>, it gives me error, but if string is actually integer, only then it lets you convert it like <code>int('10')</code>. So it is very easy to check that without even using regex or some additional checks.</p>
  
  <p>I tried this:</p>
  
  <pre><code>    function isInteger (value) {
          if ($.isNumeric(value) &amp;&amp; Number(value) % 1 === 0){
              return true;
          } else {
              return false;
          }
      }
  </code></pre>
  
  <p>It kinda works, but if I write for example <code>10.</code>, it will return true, because <code>Number</code> converts to <code>10</code>. I guess I need to use regex to check such thing?</p>
  
  <p>P.S. I searched for this question, but all answers seem to be vague and actually does not answer how to properly check for integer (not just if it is number).</p>