function myNew() { // 创建一个新对象 const obj = {} // 获取构造函数 const Constructor = [].shift.call(arguments) // 链接到原型 obj.__proto__ = Constructor.prototype // 绑定 this 并执行构造函数 const result = Constructor.apply(obj, arguments) // 确保 new 出来的是个对象 return typeof result === 'object' ? result : obj }