DEV Community

Cover image for JavaScript tips: The labeled statement
David Armendáriz
David Armendáriz

Posted on

JavaScript tips: The labeled statement

What if you type in the console something like this?

label: {}
Enter fullscreen mode Exit fullscreen mode

You won't have any errors. This is valid JS!

It turns out you can reference loops in Javascript. This was something I did not know a few days ago, but is a really cool and helpful feature in Javascript. In the following video, I explain you with examples how to use labeled statements.

Top comments (1)

Collapse
 
siddharthshyniben profile image
Siddharth • Edited

Nice. I was thinking of writing an article on this but you beat me to it!