totn JavaScript

JavaScript: Number.MIN_SAFE_INTEGER property

This JavaScript tutorial explains how to use the Number property called MIN_SAFE_INTEGER with syntax and examples.

Description

In JavaScript, MIN_SAFE_INTEGER is a static property of the Number object that is used to return the minimum safe integer value. Because MIN_SAFE_INTEGER is a property of the Number object, it must be invoked through the object called Number.

Syntax

In JavaScript, the syntax for the MIN_SAFE_INTEGER property is:

Number.MIN_SAFE_INTEGER;

Parameters or Arguments

There are no parameters or arguments for the MIN_SAFE_INTEGER property.

Returns

The MIN_SAFE_INTEGER property returns the minimum safe integer value of -9007199254740991 which can be represented as -(253 - 1).

Note

  • A safe integer is an integer value that can be exactly represented as an IEEE-754 double precision number without rounding. A safe integer can range in value from -9007199254740991 to 9007199254740991 (inclusive) which can be represented as -(253 - 1) to 253 - 1
  • The MIN_SAFE_INTEGER property is a property of the Number object and not a number function. However, we have included the MIN_SAFE_INTEGER property within our JS Number Methods section because you will most likely use this property in conjunction with the Number methods found in this section.

Example

Let's take a look at an example of how to use the MIN_SAFE_INTEGER property in JavaScript.

For example:

console.log(Number.MIN_SAFE_INTEGER);

In this example, we have invoked the MIN_SAFE_INTEGER property using the Number class.

We have written the output of the MIN_SAFE_INTEGER property to the web browser console log, for demonstration purposes, to show what the MIN_SAFE_INTEGER property returns.

The following will be output to the web browser console log:

-9007199254740991

In this example, the MIN_SAFE_INTEGER property returned a value of -9007199254740991 which represents the smallest safe integer in JavaScript.