CodeNewbie Community ๐ŸŒฑ


Posted on

How does `break` work in JavaScript?

Hola everyone! I've been doing the community taught JS-developer thing, but I've hit a snag recently. Or should I say a break?

I'm having a tough time figuring out how break works - can someone provide some clarity?

Top comments (1)

ansellmax profile image
Ansell Maximilian • Edited

It just "breaks" you out of a loop iteration and switch statements. If your code come finds a break statement during a loop iteration, it will skip that iteration and go to the next (based on some condition, for example).