English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
isSafeInteger()Method to determine whether the provided value is a safe integer.
A safe integer can be represented precisely as an IEEE-754The integer part of the double-precision number, its IEEE-754The representation cannot be rounded to any other integer to comply with IEEE-754The result represented.
If the type of the value is Number and it is a safe integer, this method returns true. Otherwise, it returns false.
Number.isSafeInteger(value)
Number.isSafeInteger(3); // true Number.isSafeInteger(NaN); // false Number.isSafeInteger(Infinity);// false Number.isSafeInteger('3'); // false Number.isSafeInteger(3.1); // false Number.isSafeInteger(3.0); // trueTest See‹/›
The numbers in the table specify the first browser version that fully supports the isSafeInteger() method:
Method | |||||
isSafeInteger() | 19 | 16 | 15 | 9 | 12 |
Parameter | Description |
---|---|
value | The value to be tested is a safe integer |
Return Value: | A boolean value indicating whether the given value is a safe integer |
---|---|
JavaScript Version: | ECMAScript 6 |