對(duì)于 Property Shadowing,我對(duì)它到底是什么感到有點(diǎn)困惑。這是否意味著如果存在內(nèi)部屬性,則不會(huì)反映原型?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!";
原型繼承屬性遮蔽
至尊寶的傳說(shuō)
2023-04-27 16:24:05