The syntax of the isInteger() method is:
Number.isInteger(value)
The isInteger() method is called using the Number class name.
Number.isInteger() Parameters
The isInteger() method takes in:
- value - The value to be tested for being an integer.
Return value from Number.isInteger()
- Returns a
Booleanrepresenting whether the given value is an integer.
Note: The isInteger() method returns false for NaN and Infinity.
Example: Using Number isInteger()
Output
true true true false false false false false false false false