欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

new

程序员文章站 2022-03-18 19:39:21
...

First, it creates a new empty object. (Already done for you here.)

Next, it sets the new object’s .__proto__ property to match the prototype property of the function being invoked.

Finally, the operator invokes the function and passes the new object as the “this” reference.

var myObj = {};
myObj.__proto__ = MyObject.prototype;
MyObject.call(myObj);


转载于:https://my.oschina.net/rickliu/blog/228516