Break and continue in Javascript

 Break and continue in Javascript

In this article we are goanna to see about Break and continue statement in Javascript and where we use these. which is most important when you are going to start your career in JavaScript. Please read and enjoy this article if you want to give any feedback about your experience, we welcome.




Break statement: The break statement is used to jump out of a loop.
Continue statement: The continue statement “jumps over” one iteration in the loop

Break Ex:

for(var i=0; i<10; i++){
if(i==5){
break;
}
document.write(i+”<br>”);
}

Continue Ex:

for(var i=0; i<10; i++){
if(i==5){
continue;
}
document.write(i+”<br>”);
}

Share:

0 comments

Please leave your comments...... Thanks