chrome的console 在 class 有get length 和 splice方法时, 使用console打印class的实例时会进入length方法,此时 this 为 class的prototype对象。
class A {
splice(){}
get length() {
debugger;
console.log(this === A.prototype);
return 0;
}
}
const a = new A();
console.log(a);
网友评论