js 模拟new
function student(name) { this.cons = name;} student.prototype.test = '678'; //创建测试方法let a = new student('12412412');console.log('a: ', a); //new 出的结果function CopyNew(testFun, ...arr) { //模拟 new let obj = Object.create(testFun.prototype); //.
原创
2020-08-07 03:47:02 ·
129 阅读 ·
0 评论