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>
document.getElementById(“demo”).innerHTML = Math.floor(4.7);
</script>

What will be the output of the following JavaScript code?
<p id=”demo”></p>
<script>
document.getElementById(“demo”).innerHTML = Math.floor(4.7);
</script>
a) 4.5
b) 4
c) 4.7
d) 5

Answer: b
Explanation: Math.floor(x) returns the value of x rounded down to its nearest integer. The value is decreased in the decimal is removed.

Join The Discussion