This JavaScript tutorial explains how to use the Number property referred to as MAX_SAFE_INTEGER with syntax and examples.
Description
In JavaScript, MAX_SAFE_INTEGER is a static property of the Number object that is used to return the maximum protected integer value. Because MAX_SAFE_INTEGER is a property of the Number object, it must be invoked thru the object known as Number.
Syntax
In JavaScript, the syntax for the MAX_SAFE_INTEGER property is:
Number.MAX_SAFE_INTEGER;
Parameters or Arguments
There are no parameters or arguments for the MAX_SAFE_INTEGER property.
Returns
The MAX_SAFE_INTEGER property returns the maximum safe integer price of 9007199254740991 which can be represented as 253 – 1.
Note
A protected integer is an integer fee that can be exactly represented as an IEEE-754 double precision variety without rounding. A protected integer can range in fee from -9007199254740991 to 9007199254740991 (inclusive) which can be represented as -(253 – 1) to 253 – 1 The MAX_SAFE_INTEGER property is a property of the Number object and not a variety function. However, we have protected the MAX_SAFE_INTEGER property inside our JS Number Methods section due to the fact you will most in all likelihood use this property in conjunction with the Number techniques found in this section.
Example
Let’s take a look at an example of how to use the MAX_SAFE_INTEGER property in JavaScript.
For example:
console.log(Number.MAX_SAFE_INTEGER);
In this example, we have invoked the MAX_SAFE_INTEGER property the usage of the Number class.
We have written the output of the MAX_SAFE_INTEGER property to the net browser console log, for demonstration purposes, to exhibit what the MAX_SAFE_INTEGER property returns.
The following will be output to the internet browser console log:
9007199254740991
In this example, the MAX_SAFE_INTEGER property again a fee of 9007199254740991 which represents the largest secure integer in JavaScript.
Leave a Review