Skip to content

Commit 5e84789

Browse files
authored
Merge pull request #448 from MartinsYong/sync-1-02-13
Update: 1-js/02-first-steps/13-switch
2 parents 31560b6 + 8ada5ca commit 5e84789

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

1-js/02-first-steps/13-switch/article.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# "switch" 语句
22

3-
`switch` 语句可以被多个 `if` 语句替代
3+
`switch` 语句可以替代多个 `if` 判断
44

55
`switch` 语句为多分支选择的情况提供了一个更具描述性的方式。
66

@@ -87,7 +87,7 @@ alert( 'Too big' );
8787
alert( "I don't know such values" );
8888
```
8989

90-
````smart header="Any expression can be a `switch/case` argument"
90+
````smart header="任何表达式都可以是 `switch/case` 的参数"
9191
`switch``case` 都允许任意表达式。
9292

9393
比如:
@@ -107,7 +107,7 @@ switch (+a) {
107107
alert("this doesn't run");
108108
}
109109
```
110-
Here `+a` gives `1`, that's compared with `b + 1` in `case`, and the corresponding code is executed.
110+
这里 `+a` 返回 `1`,这个值跟 `case``b + 1` 相比较,然后对应代码被执行。
111111
````
112112
113113
## "case" 分组
@@ -139,9 +139,9 @@ switch (a) {
139139
140140
现在 `3` 和 `5` 都显示相同的信息。
141141
142-
在没有 `break` 的情况下,`switch/case` “分组” case。 因为没有 `break`,`case 3` 会从 `(*)` 行执行到 `case 5`。
142+
在没有 `break` 的情况下,`switch/case` 会对 case“分组”因为没有 `break`,`case 3` 会从 `(*)` 行执行到 `case 5`。
143143
144-
## 值类型
144+
## 类型很关键
145145
146146
强调一下,这里的相等是严格相等。被比较的值必须是相同类型的才能匹配。
147147

0 commit comments

Comments
 (0)