+ 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