Skip to content
Related Articles

Related Articles

JavaScript Number.MIN_SAFE_INTEGER Constant
  • Last Updated : 08 Sep, 2020

Below is the example of the Number.MIN_SAFE_INTEGER Constant.

  • Example:




    <script type="text/javascript">
        document.write(Number.MIN_SAFE_INTEGER); 
    </script
  • Output:

    -9007199254740991

The JavaScript Number.MIN_SAFE_INTEGER is a constant number which represents the minimum safe integer. This constant has a value of (-(253 – 1)).

Use Number.MIN_SAFE_INTEGER, as a property of a number object because it is a static property of number.

Syntax:



Number.MIN_SAFE_INTEGER

Return Value: Constant number.

Example 1: Below example illustrates the use of simple Number.MIN_SAFE_INTEGER constant.




<!DOCTYPE html>
  
<html lang="en">
  
<body>
    <h1 style="color: green;">GeeksforGeeks</h1>
    <script type="text/javascript">
        const a = Number.MIN_SAFE_INTEGER - 1;
        const b = Number.MIN_SAFE_INTEGER - 2;
  
        console.log(Number.MIN_SAFE_INTEGER);
        console.log(a);
        console.log(a === b);
    </script>
</body>
  
</html>

Output:

Example 2: Below example illustrates the usage of Number.MIN_SAFE_INTEGER constant using Math.pow() function.




<!DOCTYPE html>
  
<html lang="en">
  
<body>
    <h1 style="color: green;">GeeksforGeeks</h1>
    <script type="text/javascript">
        const c = Number.MIN_SAFE_INTEGER;
        const d = -(Math.pow(2, 53) - 1);
  
        console.log(c);
        console.log(d);
        console.log(c === d);
    </script>
</body>
  
</html>

Output:

Note: Internet explorer is not supported.

Supported Browsers:

  1. Chrome
  2. Edge
  3. Firefox
  4. Opera
  5. Safari
My Personal Notes arrow_drop_up
Recommended Articles
Page :