Skip to content

Commit ec20c91

Browse files
committed
feat: Translate the question 34- 43 into Chinese
1 parent da8941a commit ec20c91

File tree

1 file changed

+27
-26
lines changed

1 file changed

+27
-26
lines changed

README-zh_CN.md

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,16 +1027,16 @@ typeof sayHi()
10271027

10281028
#### 答案: B
10291029

1030-
The `sayHi` function returns the returned value of the immediately invoked function (IIFE). This function returned `0`, which is type `"number"`.
1030+
`sayHi` 方法返回的是立即执行函数(IIFE)的返回值.此立即执行函数的返回值是 `0`, 类型是 `number`
10311031

1032-
FYI: there are only 7 built-in types: `null`, `undefined`, `boolean`, `number`, `string`, `object`, and `symbol`. `"function"` is not a type, since functions are objects, it's of type `"object"`.
1032+
参考:只有7种内置类型:`null``undefined``boolean``number``string``object` `symbol```function`` 不是一种类型,函数是对象,它的类型是``object``
10331033

10341034
</p>
10351035
</details>
10361036

10371037
---
10381038

1039-
###### 35. Which of these values are falsy?
1039+
###### 35. 下面哪些值是 falsy?
10401040

10411041
```javascript
10421042
0
@@ -1057,7 +1057,9 @@ undefined
10571057

10581058
#### 答案: A
10591059

1060-
There are only six falsy values:
1060+
只有 6 种 [falsy](https://developer.mozilla.org/zh-CN/docs/Glossary/Falsy) 值:
1061+
1062+
10611063

10621064
- `undefined`
10631065
- `null`
@@ -1066,7 +1068,7 @@ There are only six falsy values:
10661068
- `''` (empty string)
10671069
- `false`
10681070

1069-
Function constructors, like `new Number` and `new Boolean` are truthy.
1071+
`Function` 构造函数, 比如 `new Number` `new Boolean`,是 [truthy](https://developer.mozilla.org/zh-CN/docs/Glossary/Truthy)
10701072

10711073
</p>
10721074
</details>
@@ -1089,8 +1091,8 @@ console.log(typeof typeof 1)
10891091

10901092
#### 答案: B
10911093

1092-
`typeof 1` returns `"number"`.
1093-
`typeof "number"` returns `"string"`
1094+
`typeof 1` 返回 `"number"`
1095+
`typeof "number"` 返回 `"string"`
10941096

10951097
</p>
10961098
</details>
@@ -1115,11 +1117,11 @@ console.log(numbers)
11151117

11161118
#### 答案: C
11171119

1118-
When you set a value to an element in an array that exceeds the length of the array, JavaScript creates something called "empty slots". These actually have the value of `undefined`, but you will see something like:
1120+
当你为数组设置超过数组长度的值的时候, JavaScript 会创建名为 "empty slots" 的东西。它们的值实际上是 `undefined`。你会看到以下场景:
11191121

11201122
`[1, 2, 3, 7 x empty, 11]`
11211123

1122-
depending on where you run it (it's different for every browser, node, etc.)
1124+
这取决于你的运行环境(每个浏览器,以及 node 环境,都有可能不同)
11231125

11241126
</p>
11251127
</details>
@@ -1152,32 +1154,32 @@ depending on where you run it (it's different for every browser, node, etc.)
11521154

11531155
#### 答案: A
11541156

1155-
The `catch` block receives the argument `x`. This is not the same `x` as the variable when we pass arguments. This variable `x` is block-scoped.
1157+
`catch` 代码块接收参数 `x`。当我们传递参数时,这与之前定义的变量 `x` 不同 。这个 `x` 是属于 `catch` 块级作用域的。
11561158

1157-
Later, we set this block-scoped variable equal to `1`, and set the value of the variable `y`. Now, we log the block-scoped variable `x`, which is equal to `1`.
1159+
然后,我们将块级作用域中的变量赋值为 `1`,同时也设置了变量 `y` 的值。现在,我们打印块级作用域中的变量 `x`,值为 `1`
11581160

1159-
Outside of the `catch` block, `x` is still `undefined`, and `y` is `2`. When we want to `console.log(x)` outside of the `catch` block, it returns `undefined`, and `y` returns `2`.
1161+
`catch` 块之外的变量 `x` 的值仍为 `undefined``y` 的值为 `2`。当我们在 `catch` 块之外执行 `console.log(x)` 时,返回 `undefined``y` 返回 `2`
11601162

11611163
</p>
11621164
</details>
11631165

11641166
---
11651167

1166-
###### 39. Everything in JavaScript is either a...
1168+
###### 39. JavaScript 中的一切都是?
11671169

11681170
- A: primitive or object
11691171
- B: function or object
11701172
- C: trick question! only objects
11711173
- D: number or object
1172-
1174+
-
11731175
<details><summary><b>答案</b></summary>
11741176
<p>
11751177

11761178
#### 答案: A
11771179

1178-
JavaScript only has primitive types and objects.
1180+
JavaScript 只有原始类型和对象。
11791181

1180-
Primitive types are `boolean`, `null`, `undefined`, `bigint`, `number`, `string`, and `symbol`.
1182+
原始类型包括 `boolean`, `null`, `undefined`, `bigint`, `number`, `string`, `symbol`
11811183

11821184
</p>
11831185
</details>
@@ -1205,9 +1207,8 @@ Primitive types are `boolean`, `null`, `undefined`, `bigint`, `number`, `string`
12051207

12061208
#### 答案: C
12071209

1208-
`[1, 2]` is our initial value. This is the value we start with, and the value of the very first `acc`. During the first round, `acc` is `[1,2]`, and `cur` is `[0, 1]`. We concatenate them, which results in `[1, 2, 0, 1]`.
1209-
1210-
Then, `[1, 2, 0, 1]` is `acc` and `[2, 3]` is `cur`. We concatenate them, and get `[1, 2, 0, 1, 2, 3]`
1210+
`[1, 2]`是初始值。初始值将会作为首次调用时第一个参数 `acc` 的值。在第一次执行时, `acc` 的值是 `[1, 2]``cur` 的值是 `[0, 1]`。合并它们,结果为 `[1, 2, 0, 1]`
1211+
第二次执行, `acc` 的值是 `[1, 2, 0, 1]``cur` 的值是 `[2, 3]`。合并它们,最终结果为 `[1, 2, 0, 1, 2, 3]`
12111212

12121213
</p>
12131214
</details>
@@ -1232,18 +1233,18 @@ Then, `[1, 2, 0, 1]` is `acc` and `[2, 3]` is `cur`. We concatenate them, and ge
12321233

12331234
#### 答案: B
12341235

1235-
`null` is falsy. `!null` returns `true`. `!true` returns `false`.
1236+
`null` [falsy](https://developer.mozilla.org/zh-CN/docs/Glossary/Falsy) `!null` 的值是 `true` `!true` 的值是 `false`
12361237

1237-
`""` is falsy. `!""` returns `true`. `!true` returns `false`.
1238+
`""` [falsy](https://developer.mozilla.org/zh-CN/docs/Glossary/Falsy) `!""` 的值是 `true``!true` 的值是 `false`
12381239

1239-
`1` is truthy. `!1` returns `false`. `!false` returns `true`.
1240+
`1` [truthy](https://developer.mozilla.org/zh-CN/docs/Glossary/Truthy) `!1` 的值是 `false` `!false` 的值是 `true`
12401241

12411242
</p>
12421243
</details>
12431244

12441245
---
12451246

1246-
###### 42. What does the `setInterval` method return?
1247+
###### 42. `setInterval` 方法的返回值是什么?
12471248

12481249
```javascript
12491250
setInterval(() => console.log('Hi'), 1000)
@@ -1259,14 +1260,14 @@ setInterval(() => console.log('Hi'), 1000)
12591260

12601261
#### 答案: A
12611262

1262-
It returns a unique id. This id can be used to clear that interval with the `clearInterval()` function.
1263+
`setInterval` 返回一个唯一的 id。此 id 可被用于 `clearInterval` 函数来取消定时。
12631264

12641265
</p>
12651266
</details>
12661267

12671268
---
12681269

1269-
###### 43. What does this return?
1270+
###### 43. 输出是什么?
12701271

12711272
```javascript
12721273
;[...'Lydia']
@@ -1282,7 +1283,7 @@ It returns a unique id. This id can be used to clear that interval with the `cle
12821283

12831284
#### 答案: A
12841285

1285-
A string is an iterable. The spread operator maps every character of an iterable to one element.
1286+
string 类型是可迭代的。扩展运算符将迭代的每个字符映射成一个元素。
12861287

12871288
</p>
12881289
</details>

0 commit comments

Comments
 (0)