问题描述var Ctor = function (){};var baseCreate = function (prototype) { if(!_.isObject(prototype)) { return {}; } if(nativeCreate) { return nativeCreate(prototype); } Ctor.prototype = prototype; var result = new Ctor; Ctor.prototype = null; return result; };(Ctor.prototype = prototype)使用原型继承再(var result = new Ctor)实例化,最后(Ctor.prototype = null)为什么要清空在原型上添加的方法。
添加回答
举报
0/150
提交
取消