DEV Community

loading...
Cover image for JavaScript tips: The labeled statement

JavaScript tips: The labeled statement

David Armendáriz
・1 min read

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.

Discussion (1)

Collapse
siddharthshyniben profile image
Siddharth • Edited

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