課程
/前端開(kāi)發(fā)
/JavaScript
/JavaScript深入淺出
Student.prototype = new Person() 和 Student.prototype = Object.create(Person.prototype)有什么區(qū)別???
2016-03-13
源自:JavaScript深入淺出 8-4
正在回答
第一個(gè)只是將new Person()這個(gè)實(shí)例化對(duì)象賦值給Student對(duì)象的prototype屬性;第二個(gè)是將Student.prototype對(duì)象的原型指向Person.prototype
第一個(gè)是賦值,后面對(duì)Student.prototype的修改會(huì)影響Person,第二個(gè)是創(chuàng)建一個(gè)空對(duì)象,原型指向Person.prototype
舉報(bào)
由淺入深學(xué)習(xí)JS語(yǔ)言特性,且解析JS常見(jiàn)誤區(qū),從入門(mén)到掌握
2 回答原型鏈?zhǔn)遣皇歉黬ava繼承類似?
1 回答子對(duì)象通過(guò)原型鏈繼承父對(duì)象問(wèn)題
1 回答原型與繼承【prototype繼承為什么要修正constructor】
1 回答propertyIsEnumerable不能用來(lái)判斷原型鏈繼承過(guò)來(lái)的屬性
1 回答關(guān)于 原型的繼承 這一節(jié)的一個(gè)疑問(wèn)
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購(gòu)課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2017-06-23
第一個(gè)只是將new Person()這個(gè)實(shí)例化對(duì)象賦值給Student對(duì)象的prototype屬性;第二個(gè)是將Student.prototype對(duì)象的原型指向Person.prototype
2016-03-14
第一個(gè)是賦值,后面對(duì)Student.prototype的修改會(huì)影響Person,第二個(gè)是創(chuàng)建一個(gè)空對(duì)象,原型指向Person.prototype