JavaScript Number.isSafeInteger() Method

You are Here:

JavaScript Number.isSafeInteger() Method

The Number.isSafeInteger() method returns a Boolean value indicates whether the provided value is a number that is a safe integer.

Note: All integers from -(253 - 1) to (253 - 1) are safe integers.


HTML Online Editor
<!DOCTYPE html> <html> <body> <script> var result = Number.isSafeInteger(9999999999999999); document.write(result); </script> </body> </html>



Parameter Values

valueRequiredThe value to be tested for being a safe integer.

Return Value

trueIf the given value is a safe integer.
falseIf the given value is not a safe integer.

More Examples


HTML Online Editor
<!DOCTYPE html> <html> <body> <script> document.write(Number.isSafeInteger(25) +": 25 <br>"); document.write(Number.isSafeInteger(-987)+": -987 <br>"); document.write(Number.isSafeInteger(54 - 7)+": 54 - 7 <br>"); document.write(Number.isSafeInteger(Math.pow(2, 53) - 1)+": Math.pow(2, 53) - 1 <br><br>"); document.write(Number.isSafeInteger(Math.pow(2, 53))+": Math.pow(2, 53) <br>"); document.write(Number.isSafeInteger(5.2)+": 5.2 <br>"); document.write(Number.isSafeInteger(-25.5)+": -25.5 <br>"); document.write(Number.isSafeInteger(0 / 0)+": 0 / 0 <br>"); document.write(Number.isSafeInteger(true)+": true <br>"); document.write(Number.isSafeInteger(false)+": false <br>"); document.write(Number.isSafeInteger('65')+": '65' <br>"); document.write(Number.isSafeInteger([5])+": [5] <br>"); document.write(Number.isSafeInteger(Infinity)+": Infinity <br>"); document.write(Number.isSafeInteger(-Infinity)+": -Infinity <br>"); document.write(Number.isSafeInteger(null)+": null <br>"); </script> </body> </html>


Hi Developers, we almost covered 97% of JavaScript Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in JavaScript.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author