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?
int a=0;
for(a;a< 5;a++);
console.log(a);

What will be the output of the following JavaScript code?
int a=0;
for(a;a< 5;a++);
console.log(a);
a) 0
b) error
c) 4
d) 5

Answer: d
Explanation: The value of a will increase until it will become equal to 5 after that the cursor will come out the loop. There are no statements for the for loop therefore only the value of a will increase. Hence the output will be five.

Join The Discussion