mirror of
https://github.com/ruanyf/es6tutorial.git
synced 2025-05-29 13:52:22 +00:00
fix typo
This commit is contained in:
parent
f74f42ae57
commit
430515672c
32
docs/spec.md
32
docs/spec.md
@ -34,7 +34,7 @@ ECMAScript 6规格的26章之中,第1章到第3章是对文件本身的介绍
|
||||
|
||||
规格对每一种语法行为的描述,都分成两部分:先是总体的行为描述,然后是实现的算法细节。相等运算符的总体描述,只有一句话。
|
||||
|
||||
> “The comparison `x == y`, where x and y are values, produces `true` or `false`.”
|
||||
> “The comparison `x == y`, where `x` and `y` are values, produces `true` or `false`.”
|
||||
|
||||
上面这句话的意思是,相等运算符用于比较两个值,返回`true`或`false`。
|
||||
|
||||
@ -42,21 +42,21 @@ ECMAScript 6规格的26章之中,第1章到第3章是对文件本身的介绍
|
||||
|
||||
> 1. ReturnIfAbrupt(x).
|
||||
> 1. ReturnIfAbrupt(y).
|
||||
> 1. If Type(x) is the same as Type(y), then
|
||||
> Return the result of performing Strict Equality Comparison x === y.
|
||||
> 1. If x is null and y is undefined, return true.
|
||||
> 1. If x is undefined and y is null, return true.
|
||||
> 1. If Type(x) is Number and Type(y) is String,
|
||||
> return the result of the comparison x == ToNumber(y).
|
||||
> 1. If Type(x) is String and Type(y) is Number,
|
||||
> 1. If `Type(x)` is the same as `Type(y)`, then
|
||||
> Return the result of performing Strict Equality Comparison `x === y`.
|
||||
> 1. If `x` is `null` and `y` is `undefined`, return `true`.
|
||||
> 1. If `x` is `undefined` and `y` is `null`, return `true`.
|
||||
> 1. If `Type(x)` is Number and `Type(y)` is String,
|
||||
> return the result of the comparison `x == ToNumber(y)`.
|
||||
> 1. If `Type(x)` is String and `Type(y)` is Number,
|
||||
> return the result of the comparison ToNumber(x) == y.
|
||||
> 1. If Type(x) is Boolean, return the result of the comparison ToNumber(x) == y.
|
||||
> 1. If Type(y) is Boolean, return the result of the comparison x == ToNumber(y).
|
||||
> 1. If Type(x) is either String, Number, or Symbol and Type(y) is Object, then
|
||||
> return the result of the comparison x == ToPrimitive(y).
|
||||
> 1. If Type(x) is Object and Type(y) is either String, Number, or Symbol, then
|
||||
> return the result of the comparison ToPrimitive(x) == y.
|
||||
> 1. Return false.
|
||||
> 1. If `Type(x)` is Boolean, return the result of the comparison `ToNumber(x) == y`.
|
||||
> 1. If `Type(y)` is Boolean, return the result of the comparison `x == ToNumber(y)`.
|
||||
> 1. If `Type(x)` is either String, Number, or Symbol and `Type(y)` is Object, then
|
||||
> return the result of the comparison `x == ToPrimitive(y)`.
|
||||
> 1. If `Type(x)` is Object and `Type(y)` is either String, Number, or Symbol, then
|
||||
> return the result of the comparison `ToPrimitive(x) == y`.
|
||||
> 1. Return `false`.
|
||||
|
||||
上面这段算法,一共有12步,翻译如下。
|
||||
|
||||
@ -138,7 +138,7 @@ a2.map(n => 1) // [, , ,]
|
||||
|
||||
后面的算法描述是这样的。
|
||||
|
||||
> 1. Let O be ToObject(this value).
|
||||
> 1. Let `O` be `ToObject(this value)`.
|
||||
> 1. ReturnIfAbrupt(O).
|
||||
> 1. Let len be ToLength(Get(O, "length")).
|
||||
> 1. ReturnIfAbrupt(len).
|
||||
|
Loading…
x
Reference in New Issue
Block a user