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 x = 100;
document.getElementById(“demo”).innerHTML = x.NEGATIVE_INFINITY;
}
</script>

What will be the output of the following JavaScript code?
<p id=”demo”></p>
<script>
function myFunction()
{
var x = 100;
document.getElementById(“demo”).innerHTML = x.NEGATIVE_INFINITY;
}
</script>
a) true
b) false
c) error
d) undefined

Answer: d
Explanation: NEGATIVE_INFINITY is a static property of the JavaScript Number object. Using x.NEGATIVE_INFINITY, where x is a number or a Number object, will return undefined.

Join The Discussion