最近在看You don’t know JS: this and object prototypes一书,看到原型链继承还是不大清晰,于是找了一些资料,特别是关于Object.create()方法和new Constructer()的区别。
Object.create(OBJ):
new Constructor():
return Constructor.call(obj) | obj; |
Object.create()方法主要是原型链继承,不会有new方法Constructor执行带来的副作用。
changecheng 01 September 2016