Files

9 lines
667 B
Markdown
Raw Permalink Normal View History

2026-06-12 11:06:50 +02:00
# Switch
The `switch` statement evaluates an expression and executes the matching `case` block. It is an alternative to a long chain of `if...else if` statements when comparing one value against multiple options. Each `case` should typically end with a `break` to prevent fall-through to the next case.
2023-01-02 04:47:46 +04:00
Visit the following resources to learn more:
2024-06-06 23:23:55 +01:00
- [@article@switch - MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch)
2026-06-12 11:06:50 +02:00
- [@article@The switch Statement: Why, What and How - CodeGuage](https://www.codeguage.com/courses/js/conditions-switch)
- [@article@The switch statement - javascript.info](https://javascript.info/switch)