mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2025-02-24 11:33:09 +01:00
Update JavaScript switch statement (#2161)
add syntax highlighting in code snippet.
This commit is contained in:
parent
b6818a42ea
commit
7af71de4f2
@ -1,8 +1,9 @@
|
||||
# Switch
|
||||
# Switch Case
|
||||
|
||||
The `switch` statement evaluates an expression, matching the expression's value against a series of `case` clauses, and executes statements after the first `case` clause with a matching value, until a `break` statement is encountered. The `default` clause of a `switch` statement will be jumped to if no `case` matches the expression's value.
|
||||
|
||||
```
|
||||
## Example
|
||||
```js
|
||||
switch (expression) {
|
||||
case value1:
|
||||
//Statements executed when the result of expression matches value1
|
||||
@ -22,4 +23,4 @@ switch (expression) {
|
||||
|
||||
<ResourceGroupTitle>Free Content</ResourceGroupTitle>
|
||||
<BadgeLink colorScheme='blue' badgeText='Read' href='https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch'>switch - MDN</BadgeLink>
|
||||
<BadgeLink colorScheme='blue' badgeText='Read' href='https://javascript.info/switch'>The switch statement</BadgeLink>
|
||||
<BadgeLink colorScheme='blue' badgeText='Read' href='https://javascript.info/switch'>The switch statement - javascript.info</BadgeLink>
|
||||
|
Loading…
x
Reference in New Issue
Block a user