JavaScript Number.MIN_SAFE_INTEGER Constant
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:
- Chrome 34 and above
- Edge 12 and above
- Firefox 31 and above
- Opera 21 and above
- Safari 9 and above