Javascript is_int() Click here to view the is_int() demo (URL: /javascript-is-int-demo.html) There isn't a JavaScript is_int() function built in to JavaScript. However, you can copy and paste this into your JavaScript and use it just like you would in PHP: The Function Warning!  is_int() doesn't always work if you are validating form input! This is because form inputs are strings, even if the user typed a number. When validating form input, use this: Using is_int Using is_int() is easy. Just call it on an input the same as you would in PHP. In this example, we check if the variable age is an int: Using form_input_is_int() Use form_input_is_int() when validating form input. For example: Or, when pulling input from a form: Code Explanation is_int() is a really easy function. The typeof() function accepts any input and will return that input's type. So, we need to be sure that the type of our input is 'number'. The parseInt() function takes any input and returns only the integer value. So, parseInt(4.12) == 4. Therefore, if parseInt(input) == input, that means input is an int. In form_input_is_int() we also use the JavaScript function isNaN(). NaN stands for "Not a Number". So, if the input is not a number, isNaN() returns true.