Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What will be the output of the following JavaScript code?
<p id=”demo”></p>
<script>
function myFunction()
{
var res = “”;
res=res + Number.isSafeInteger(Math.pow(2, 53)-1)+”: 253-1
“;
document.getElementById(“demo”).innerHTML = res;
}
</script>

What will be the output of the following JavaScript code?
<p id=”demo”></p>
<script>
function myFunction()
{
var res = “”;
res=res + Number.isSafeInteger(Math.pow(2, 53)-1)+”: 253-1
“;
document.getElementById(“demo”).innerHTML = res;
}
</script>
a) True
b) false
c) error
d) undefined

Answer: a
Explanation: The Number.isSafeInteger() method determines whether a value is a safe integer. A safe integer is an integer that can be exactly represented as an IEEE-754 double precision number (all integers from (253 – 1) to -(253 – 1)).

Join The Discussion