30 Days Of JavaScript

Day 4: Loops

Lesson 4: Break

Sometimes you will want to end a loop early. This is what break is for.

Not much to this, other than to say if you execute a break inside a loop it will end the loop and go to the next line of code after the loop.

In the code above you get 4 and 8, as soon as 11 === 11 is run, the break command jumps us out of the loop.


Go Pro?

Upgrade to Pro for quizzes, tracked progress and a completion certificate for just $25 🚀

Want more developer tips, tricks and tools?
Then follow me:
FREE Coding Career Quick Start Guide 🚀
Discover the best way to learn to code, how to land a job and valuable resources to help your journey in this free 15 page value packed guide.
Looking to email me? You can get me on my first name at allthecode.co