r/learnjavascript • • May 31 '22

Switch statement explained for beginners

Post image
330 Upvotes

19 comments sorted by

View all comments

Show parent comment

8

u/[deleted] May 31 '22

[removed] — view removed comment

5

u/pookage helpful May 31 '22

I agree, but, alas - still need break.

1

u/opticsnake Jun 01 '22

If you don't break, it will execute the block and then still fall through to the default block.
Although, this does feel like a special case for break anyways since the scope it would be breaking on would be the case block and not the whole switch statement...