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?
var a=2.99;
var ans=floor(a)*floor(a)
console.log(ans);

What will be the output of the following JavaScript code?
var a=2.99;
var ans=floor(a)*floor(a)
console.log(ans);
a) 9
b) 8.31
c) Error
d) 4

Answer: d
Explanation: The floor method round offs the value of the decimal number to the lower limit. Therefore floor of a will be 2 which will result in the output of 4.

Join The Discussion