mirror of
https://github.com/alrayyes/wiki.git
synced 2025-07-24 17:59:33 +00:00
Quartz sync: May 6, 2024, 10:40 PM
This commit is contained in:
parent
aee9145691
commit
4ef8371441
635 changed files with 22281 additions and 6 deletions
50
content/20201030094138-javascript_switch_statement.md
Normal file
50
content/20201030094138-javascript_switch_statement.md
Normal file
|
@ -0,0 +1,50 @@
|
|||
---
|
||||
id: 7af3c0d0-b8aa-4619-81eb-cad43b3698bb
|
||||
title: JavaScript Switch Statement
|
||||
---
|
||||
|
||||
# Syntax
|
||||
|
||||
``` javascript
|
||||
switch ("rainy") {
|
||||
case "rainy":
|
||||
console.log("Remember to bring an umbrella.");
|
||||
break;
|
||||
case "sunny":
|
||||
console.log("Dress lightly.");
|
||||
case "cloudy":
|
||||
console.log("Go outside.");
|
||||
break;
|
||||
default:
|
||||
console.log("Unknown weather type!");
|
||||
break;
|
||||
}
|
||||
|
||||
switch ("sunny") {
|
||||
case "rainy":
|
||||
console.log("Remember to bring an umbrella.");
|
||||
break;
|
||||
case "sunny":
|
||||
console.log("Dress lightly.");
|
||||
case "cloudy":
|
||||
console.log("Go outside.");
|
||||
break;
|
||||
default:
|
||||
console.log("Unknown weather type!");
|
||||
break;
|
||||
}
|
||||
|
||||
switch ("wild card") {
|
||||
case "rainy":
|
||||
console.log("Remember to bring an umbrella.");
|
||||
break;
|
||||
case "sunny":
|
||||
console.log("Dress lightly.");
|
||||
case "cloudy":
|
||||
console.log("Go outside.");
|
||||
break;
|
||||
default:
|
||||
console.log("Unknown weather type!");
|
||||
break;
|
||||
}
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue