The isSafeInteger() function of the Number object accepts a number and determines if it is safe integer. If the given number is a safe integer it returns true else, it returns false.
Syntax
Its Syntax is as follows
Number.isSafeInteger(90071991);
Example
Live Demo
<html>
<head>
<title>JavaScript Example</title>
</head>
<body>
<script type="text/javascript">
var result = Number.isSafeInteger(90071991);
if(result) {
document.write("Given number is a safe integer");
}else {
document.write("Given number is not a safe integer");
}
</script>
</body>
</html>
Output
Given number is a safe integer
Example
Passing Decimal value, negative value and an equation to this function.
Live Demo
<html>
<head>
<title>JavaScript Example</title>
</head>
<body>
<script type="text/javascript">
var result1 = Number.isSafeInteger(45.2);
document.write(result1);
document.write("<br>");
var result2 = Number.isSafeInteger(-38);
document.write(result2);
document.write("<br>");
var result3 = Number.isSafeInteger(0/8);
document.write(result3);
document.write("<br>");
</script>
</body>
</html>
Output
false
true
true