Skip to content

Commit e3a76b6

Browse files
authored
Merge pull request ruanyf#435 from dancon/patch-1
Update class.md
2 parents c2d5bb2 + c0d339a commit e3a76b6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

docs/class.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,8 @@ p1.__proto__ === p2.__proto__
290290

291291
这也意味着,可以通过实例的`__proto__`属性为“类”添加方法。
292292

293+
> `__proto__` 并不是语言本身的特性,这是各大厂商具体实现时添加的私有属性,虽然目前很多现代浏览器的JS引擎中都提供了这个私有属性,但依旧不建议在生产中使用该属性,避免对环境产生依赖。生产环境中,我们可以使用 `Object.getPrototypeOf` 方法来获取实例对象的原型,然后再来为原型添加方法/属性。
294+
293295
```javascript
294296
var p1 = new Point(2,3);
295297
var p2 = new Point(3,2);

0 commit comments

Comments
 (0)