Skip to content
Advertisement

Break statement inside two while loops

Let’s say I have this:

JavaScript

Question: Will the break statement take me out of both loops or only from the inner one? Thank you.

Advertisement

Answer

In your example break statement will take you out of while(b) loop

JavaScript
Advertisement