let target;
function A(a) {
this.a = a;
target = new.target;
}
const B = A.bind();
const C = B.bind();
const f = Reflect.construct(C, [], B);
console.log(target === A, Object.getPrototypeOf(f) === A.prototype);
其中 B.prototype 和 C.prototype 为什么为undefiend?
为什么 ?
输出 B 为 function A
输出 C 为 native code
Reflect.contruct(C, [], B)
难道不是以下转换吗?
f = new C()
f.__proto__ = B.prototype
Object.getPrototypeOf(f) === A.prototype
难道不是以下转换吗(结合上述推论)?
f.__proto__ === A.prototype
f.__proto__ === B.prototype
B.prototype ? === A.prototype
B.prototype = undefined
A.prototype = {
constructor: A
__proto__: xx
}
以上疑问无法得到解答,麻烦前辈们指导下,或者解析下这个题目。(非常感谢)