English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

JavaScript isSafeInteger() method

 JavaScript Number Object

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.

Syntax:

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); // true
Test See‹/›

Browser Compatibility

The numbers in the table specify the first browser version that fully supports the isSafeInteger() method:

Method
isSafeInteger()191615912

Parameter Value

ParameterDescription
valueThe value to be tested is a safe integer

Technical Details

Return Value:A boolean value indicating whether the given value is a safe integer
JavaScript Version:ECMAScript 6

 JavaScript Number Object