new 做了什么
new 做了什么
function myNew(fn, ...args){ let obj = {} obj.__proto__ = fn.prototype let result = fn.call(obj, ...args) return typeof result === 'object' ? result : obj; }
new 做了什么
function myNew(fn, ...args){ let obj = {} obj.__proto__ = fn.prototype let result = fn.call(obj, ...args) return typeof result === 'object' ? result : obj; }