Using Number.MIN_SAFE_INTEGER property to coding in Javascript/JS

This JavaScript tutorial explains how to use the Number property known as 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 minimal protected integer value. Because MIN_SAFE_INTEGER is a property of the Number object, it ought to be invoked via 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 price of -9007199254740991 which can be represented as -(253 – 1).

Note

A protected integer is an integer cost that can be precisely represented as an IEEE-754 double precision quantity barring rounding. A secure 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 range function. However, we have protected the MIN_SAFE_INTEGER property within our JS Number Methods section because you will most possibly use this property in conjunction with the Number techniques located in this section.

Example

Let’s take a seem to be 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 the usage of the Number class.

We have written the output of the MIN_SAFE_INTEGER property to the net browser console log, for demonstration purposes, to exhibit 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 back a value of -9007199254740991 which represents the smallest protected integer in JavaScript.