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 role of the continue keyword in the following JavaScript code snippet?
while (a != 0)
{
if (a == 1)
continue;
else
a++;
}

What will be the role of the continue keyword in the following JavaScript code snippet?
while (a != 0)
{
if (a == 1)
continue;
else
a++;
}
a) The continue keyword restarts the loop
b) The continue keyword skips the next iteration
c) The continue keyword skips the rest of the statements in that iteration
d) The continue keyword breaks out of the loop

Answer: c
Explanation: Instead of exiting a loop like the break keyword, the continue keyword moves to the next iteration from the place encountered. While the break statement breaks out of the loop.

Join The Discussion