对于 Property Shadowing,我对它到底是什么感到有点困惑。这是否意味着如果存在内部属性,则不会反映原型?
let foo = function() {
this.word = "HI!";
}
foo.prototype.word = function() {
return "123456";
}
let test = new foo();
// does this return "HI!" rather than "123456" because `word` exists as an
// internal property and that takes importance vs. the prototype?
test.word; // "HI!";
叮当猫咪
相关分类