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
推荐阅读