手动实现new方法 柚子UV 2019-08-04 107 阅读1分钟 function create(){ let obj={}; let constructor=[].shift.call(arguments); obj.__proto__=constructor.prototype; let result=constructor.apply(obj,arguments); return typeof result==="object"?result:obj; }