JavaScript Number.isInteger() Method
The Number.isInteger() static method checks whether a value is a whole number.
Description
The Number.isInteger() static method determines whether the value is an integer. Numbers like 5.0 count, because JavaScript doesn't distinguish them from 5. Strings, NaN and Infinity return false.
Very large numbers are always integers in floating point, so Number.isInteger(1e300) is true, even though the value can't be represented exactly. Use Number.isSafeInteger() when you need to be sure every digit is correct, such as for IDs.
It's handy for validating input, such as quantities that must be whole numbers, after converting the input with Number(). Like other static members of Number, it is called on the Number constructor itself, not on individual number values.
Syntax
Number.isInteger(value)Parameters
- valueThe value to check.
Return Value
true if the value is an integer, otherwise false.
Example
Browser Support
The following information will show you the current browser support for the Number.isInteger() method. Hover over a browser icon to see the version that first introduced support for this method.
Desktop





Tablets & Mobile





