84
JavaScript Number isInteger() method
The JavaScript number isInteger() method determines whether the given value is an integer. It returns true if the value is an integer, otherwise it returns false.
Syntax
The isInteger() method is represented by the following syntax:
Parameter
num – A number to be checked.
Return
A Boolean value.
JavaScript Number isInteger() method example
Here, we will understand isInteger() method through various examples.
Example 1
Let’s see a simple example of isInteger() method.
Output:
true true true
Example 2
Let’s see isInteger() method with some test cases.
Output:
true false
Example 3
Let’s see some values for which isInteger() method returns false.
Output:
false false false false false false
Next TopicJavaScript Math