Number.isSafeInteger

isSafeInteger – Check whether an integer is in the safe range.

Description

Number.isSafeInteger(integer integer)

Parameters

Name Description Type Default Optional
integer integer No

Return values

boolean.

Changelog

Version Description
ES 6 Introduced.

Examples

Example #1 – isSafeInteger example
console.log(Number.isSafeInteger(12)); // true console.log(Number.isSafeInteger(12.42)); // false console.log(Number.isSafeInteger(12345678901234567890)); // false console.log(Number.isSafeInteger('12')); // false console.log(Number.isSafeInteger(NaN)); // false console.log(Number.isSafeInteger(Infinity)); // false

External references