mirror of
https://github.com/ruanyf/es6tutorial.git
synced 2024-04-21 12:32:22 +00:00
docs: 修正已知的 this 术语错误
This commit is contained in:
+1
-1
@@ -253,7 +253,7 @@ point.hasOwnProperty('toString') // false
|
||||
point.__proto__.hasOwnProperty('toString') // true
|
||||
```
|
||||
|
||||
上面代码中,`x`和`y`都是实例对象`point`自身的属性(因为定义在`this`变量上),所以`hasOwnProperty()`方法返回`true`,而`toString()`是原型对象的属性(因为定义在`Point`类上),所以`hasOwnProperty()`方法返回`false`。这些都与 ES5 的行为保持一致。
|
||||
上面代码中,`x`和`y`都是实例对象`point`自身的属性(因为定义在`this`对象上),所以`hasOwnProperty()`方法返回`true`,而`toString()`是原型对象的属性(因为定义在`Point`类上),所以`hasOwnProperty()`方法返回`false`。这些都与 ES5 的行为保持一致。
|
||||
|
||||
与 ES5 一样,类的所有实例共享一个原型对象。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user