js实现new
function New(fn,...args){ let obj={} obj.__proto__=fn.prototype let result=fn.apply(obj,args) if(typeof result==='object'||typeof result==='function'){ return result } return obj }
function New(fn,...args){ let obj={} obj.__proto__=fn.prototype let result=fn.apply(obj,args) if(typeof result==='object'||typeof result==='function'){ return result } return obj }