Break in loop JavaScript | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Break in loop JavaScript

Does br mean break in the loop?

26th Apr 2019, 2:32 PM
victor
victor - avatar
4 Answers
+ 5
Your question is confusing a bit. "Br" and "Break" are different things. <br> tag is used in HTML to put a line break. And Break is used in programming languages to break loops unconditional or conditionally. For example : var i = 0; while(true){ if (i > 10){ break; } } In above example, i is initialized with 0 and while loop will run forever because condition is given true, now inside loop it will check if i is greater than 10, if it is then it will stop the loop running.
26th Apr 2019, 2:39 PM
Raj Chhatrala
Raj Chhatrala - avatar
+ 2
victor, you're welcome!
9th May 2019, 10:58 AM
Alessio Benvenuti
Alessio Benvenuti - avatar
+ 1
The break statement exits a switch statement or a loop (for, for ... in, while,do ... while). When the breakstatement is used in a loop, it breaksthe loop and continues executing the code after the loop (if any).
26th Apr 2019, 2:33 PM
Alessio Benvenuti
Alessio Benvenuti - avatar
+ 1
thx
26th Apr 2019, 6:45 PM
victor
victor - avatar