JavaScript Number MAX_SAFE_INTEGER Property

The JavaScript Number.MAX_SAFE_INTEGER is a constant number that represents the maximum safe integer. This constant has a value of (253 – 1). Here safe refers to the ability to represent integers and to compare them.
Syntax:
Number.MAX_SAFE_INTEGER
Return Value: A constant number.
Example 1: Below example illustrates the usage of Number.MAX_SAFE_INTEGER
Javascript
const a = Number.MAX_SAFE_INTEGER + 1; const b = Number.MAX_SAFE_INTEGER + 2; console.log(Number.MAX_SAFE_INTEGER); console.log(a); console.log(a === b); |
Output:
9007199254740991 9007199254740992 true
Example 2: Below example illustrates the usage of the constants Number.MAX_SAFE_INTEGER using Math.pow() function.
Javascript
const a = Number.MAX_SAFE_INTEGER; const b = -(Math.pow(2, 53) - 1); console.log(a); console.log(b); console.log(a === b); |
Output:
9007199254740991 -9007199254740991 false
Supported Browsers:
- Chrome 34 and above
- Internet Explorer (Not Supported)
- Firefox 31 and above
- Edge 12 and above
- Safari 9 and above
- Opera 21 and above
We have a complete list of JavaScript Number constructor, properties, and methods list, to know more about the numbers please go through that article.
Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, zambiatek Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!


