Skip to content

Commit d066d47

Browse files
committed
fix typo
1 parent 4305156 commit d066d47

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

docs/spec.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ ECMAScript 6规格的26章之中,第1章到第3章是对文件本身的介绍
4949
> 1. If `Type(x)` is Number and `Type(y)` is String,
5050
> return the result of the comparison `x == ToNumber(y)`.
5151
> 1. If `Type(x)` is String and `Type(y)` is Number,
52-
> return the result of the comparison ToNumber(x) == y.
52+
> return the result of the comparison `ToNumber(x) == y`.
5353
> 1. If `Type(x)` is Boolean, return the result of the comparison `ToNumber(x) == y`.
5454
> 1. If `Type(y)` is Boolean, return the result of the comparison `x == ToNumber(y)`.
5555
> 1. If `Type(x)` is either String, Number, or Symbol and `Type(y)` is Object, then
5656
> return the result of the comparison `x == ToPrimitive(y)`.
57-
> 1. If `Type(x)` is Object and `Type(y)` is either String, Number, or Symbol, then
57+
> 1. If `Type(x)` is Object and `Type(y)` is either String, Number, or Symbol, then
5858
> return the result of the comparison `ToPrimitive(x) == y`.
5959
> 1. Return `false`.
6060
@@ -73,7 +73,7 @@ ECMAScript 6规格的26章之中,第1章到第3章是对文件本身的介绍
7373
> 1. 如果`Type(x)`是对象,`Type(y)`是字符串或数值或`Symbol`值,返回`ToPrimitive(x) == y`的结果。
7474
> 1. 返回`false`
7575
76-
由于`0`的类型是数值,`null`的类型是Null(这是规格[4.3.13小节](http://www.ecma-international.org/ecma-262/6.0/#sec-4.3.13)的规定,是内部Type运算的结果,跟`typeof`运算符无关)。因此上面的前11步运算步骤都得不到结果,要到第12步才能得到`false`
76+
由于`0`的类型是数值,`null`的类型是Null(这是规格[4.3.13小节](http://www.ecma-international.org/ecma-262/6.0/#sec-4.3.13)的规定,是内部Type运算的结果,跟`typeof`运算符无关)。因此上面的前11步都得不到结果,要到第12步才能得到`false`
7777

7878
```javascript
7979
0 == null // false
@@ -139,27 +139,27 @@ a2.map(n => 1) // [, , ,]
139139
后面的算法描述是这样的。
140140

141141
> 1. Let `O` be `ToObject(this value)`.
142-
> 1. ReturnIfAbrupt(O).
143-
> 1. Let len be ToLength(Get(O, "length")).
144-
> 1. ReturnIfAbrupt(len).
145-
> 1. If IsCallable(callbackfn) is false, throw a TypeError exception.
146-
> 1. If thisArg was supplied, let T be thisArg; else let T be undefined.
147-
> 1. Let A be ArraySpeciesCreate(O, len).
148-
> 1. ReturnIfAbrupt(A).
149-
> 1. Let k be 0.
150-
> 1. Repeat, while k < len
151-
> a. Let Pk be ToString(k).
152-
> b. Let kPresent be HasProperty(O, Pk).
153-
> c. ReturnIfAbrupt(kPresent).
154-
> d. If kPresent is true, then
155-
> d-1. Let kValue be Get(O, Pk).
156-
> d-2. ReturnIfAbrupt(kValue).
157-
> d-3. Let mappedValue be Call(callbackfn, T, «kValue, k, O»).
158-
> d-4. ReturnIfAbrupt(mappedValue).
159-
> d-5. Let status be CreateDataPropertyOrThrow (A, Pk, mappedValue).
160-
> d-6. ReturnIfAbrupt(status).
161-
> e. Increase k by 1.
162-
> 1. Return A.
142+
> 1. `ReturnIfAbrupt(O)`.
143+
> 1. Let `len` be `ToLength(Get(O, "length"))`.
144+
> 1. `ReturnIfAbrupt(len)`.
145+
> 1. If `IsCallable(callbackfn)` is `false`, throw a TypeError exception.
146+
> 1. If `thisArg` was supplied, let `T` be `thisArg`; else let `T` be `undefined`.
147+
> 1. Let `A` be `ArraySpeciesCreate(O, len)`.
148+
> 1. `ReturnIfAbrupt(A)`.
149+
> 1. Let `k` be 0.
150+
> 1. Repeat, while `k` < `len`
151+
> a. Let `Pk` be `ToString(k)`.
152+
> b. Let `kPresent` be `HasProperty(O, Pk)`.
153+
> c. `ReturnIfAbrupt(kPresent)`.
154+
> d. If `kPresent` is `true`, then
155+
> d-1. Let `kValue` be `Get(O, Pk)`.
156+
> d-2. `ReturnIfAbrupt(kValue)`.
157+
> d-3. Let `mappedValue` be `Call(callbackfn, T, «kValue, k, O»)`.
158+
> d-4. `ReturnIfAbrupt(mappedValue)`.
159+
> d-5. Let `status` be `CreateDataPropertyOrThrow (A, Pk, mappedValue)`.
160+
> d-6. `ReturnIfAbrupt(status)`.
161+
> e. Increase `k` by 1.
162+
> 1. Return `A`.
163163
164164
翻译如下。
165165

@@ -177,12 +177,12 @@ a2.map(n => 1) // [, , ,]
177177
> b. 设定`kPresent`等于`HasProperty(O, Pk)`,即求当前数组有没有指定属性
178178
> c. 如果报错就返回
179179
> d. 如果`kPresent`等于`true`,则进行下面步骤
180-
> d-1. 设定`kValue`等于`Get(O, Pk)`,取出当前数组的指定属性
181-
> d-2. 如果报错就返回
182-
> d-3. 设定`mappedValue`等于`Call(callbackfn, T, «kValue, k, O»)`,即执行回调函数
183-
> d-4. 如果报错就返回
184-
> d-5. 设定`status`等于`CreateDataPropertyOrThrow (A, Pk, mappedValue)`,即将回调函数的值放入`A`数组的指定位置
185-
> d-6. 如果报错就返回
180+
> d-1. 设定`kValue`等于`Get(O, Pk)`,取出当前数组的指定属性
181+
> d-2. 如果报错就返回
182+
> d-3. 设定`mappedValue`等于`Call(callbackfn, T, «kValue, k, O»)`,即执行回调函数
183+
> d-4. 如果报错就返回
184+
> d-5. 设定`status`等于`CreateDataPropertyOrThrow (A, Pk, mappedValue)`,即将回调函数的值放入`A`数组的指定位置
185+
> d-6. 如果报错就返回
186186
> e. `k`增加1
187187
> 1. 返回`A`
188188

0 commit comments

Comments
 (0)