對于 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!";
原型繼承屬性遮蔽
至尊寶的傳說
2023-04-27 16:24:05