English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
isInteger()The method determines whether the passed value is an integer.
If the passed parameter is an integer, it returns true; otherwise, it returns false.
If the passed parameter is NaN or infinite, it returns false.
Number.isInteger(value)
Number.isInteger(0); // true Number.isInteger(1); // true Number.isInteger(20);// true Number.isInteger(25);// true Number.isInteger(-100000); // true Number.isInteger(0.1); // false Number.isInteger(3.14); // false Number.isInteger(NaN); // false Number.isInteger(Infinity); // false Number.isInteger('10'); // false Number.isInteger(true); // false Number.isInteger(false); // falseTest See‹/›
The number in the table specifies the first browser version that fully supports the isInteger() method:
Method | |||||
isInteger() | 19 | 16 | 15 | 9 | 12 |
Parameter | Description |
---|---|
value | The value to be tested is an integer |
Return Value: | A boolean value indicating whether the given value is an integer |
---|---|
JavaScript Version: | ECMAScript 6 |