my-blog icon indicating copy to clipboard operation
my-blog copied to clipboard

new操作符具体做了什么

Open luoxue-victor opened this issue 5 years ago • 0 comments

  1. 创建一个空对象,并且this变量引用该对象,同时继承了该函数的原型(实例对象通过__proto__属性指向原型对象;obj.proto = Base.prototype;)

  2. 属性和方法被加入到 this 引用的对象中。

luoxue-victor avatar Oct 16 '19 12:10 luoxue-victor