關(guān)于Student.prototype的修改
因?yàn)镾tudent.prototype屬性中存儲(chǔ)的值是原型對(duì)象,等于說Student.prototype并不是原型對(duì)象,而原型對(duì)象是實(shí)例的原型,當(dāng)有實(shí)例存在時(shí),修改的是Student.prototype的值,而不是當(dāng)前實(shí)例的原型(當(dāng)前實(shí)例的原型仍然是之前的Student.prototype值),所以bosn.y無法取得值,而只有新創(chuàng)建實(shí)例時(shí),它(新的實(shí)例)的原型才是修改后的Student.prototype值。
老師,這么理解對(duì)嗎?
2015-06-21
看不懂你的邏輯-_-