mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-06-19 21:09:51 +08:00
fix(curriculum): Add break and default to switch review (#58305)
Co-authored-by: Sem Bauke <sem@freecodecamp.org>
This commit is contained in:
parent
f3b09f0e8a
commit
de3a6eb4dc
@ -28,7 +28,7 @@ console.log(null === undefined); // false
|
||||
|
||||
## `switch` Statements
|
||||
|
||||
- **Definition**: A `switch` statement evaluates an expression and matches its value against a series of `case` clauses. When a match is found, the code block associated with that case is executed.
|
||||
- **Definition**: A `switch` statement evaluates an expression and matches its value against a series of `case` clauses. When a match is found, the code block associated with that case is executed. A `break` statement should be placed at the end of each case, to terminate its execution and continue with the next. The `default` case is an optional case and only executes if none of the other cases match. The `default` case is placed at the end of a `switch` statement.
|
||||
|
||||
```js
|
||||
const dayOfWeek = 3;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user