day031: 能不能模拟实现一个new的效果?

new被调用后作了三件事情:app 让实例能够访问到私有属性 让实例能够访问构造函数原型(constructor.prototype)所在原型链上的属性 若是构造函数返回的结果不是引用数据类型 function newOperator(ctor, ...args) { if(typeof ctor !== 'function'){ throw 'newOperator function the
相关文章
相关标签/搜索