0 votes
in JavaScript by
What is the role of the "continue" keyword in the following piece of JavaScript code?

while (x !=0)  

{  

if(x ==1)  

continue;  

else  

       x++;  

}  

a) The continue keyword restarts the loop

b) The continue keyword skips the next iteration

c) The "continue" keyword breaks out of the loop

d) It is used for skipping the rest of the statements in that particular iteration

1 Answer

0 votes
by

Answer: D

Reason: The continue keyword does not get exit from the loop just like break keyword does. It skips the upcoming statements in that iteration form where it gets encountered, and instead of exiting the loop, it moves to the next iteration.

Related questions

0 votes
asked Mar 23, 2021 in JavaScript by sharadyadav1986
0 votes
asked Mar 22, 2021 in JavaScript by Robindeniel
...