Course Content
Introduction to JavaScript
break
The break
keyword is a loop leaver. You can stop the loop with the break
keyword helps.
Let's stop infinity loop:
The break
keyword stopped infinity while
loop when i
is equal to 6
(after the i++
operation).
One more example:
The variable a
is incremented by the i
each iteration (0 + 1 + 2 + 3 + 4) until i
is equal to 4.
The simplest example:
Note
All code below the
break
will not be executed.
Section 5.
Chapter 6