谷歌浏览器打印class对象
2022-02-11 本文已影响0人
storyWrite
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);