課程
/前端開發(fā)
/JavaScript
/JavaScript深入淺出
討論內(nèi)容如圖
2016-07-13
源自:JavaScript深入淺出 1-5
正在回答
你的是賦值操作,不是判斷操作。
你的意思是想讓Student構造函數(shù)繼承Person
Student.prototype=new Person();
相當于改寫默認的Student.prototye
讓Student.prototype指向new Person()的實例
俠客島的含笑 提問者
慕粉3377762 回復 俠客島的含笑 提問者
俠客島的含笑 提問者 回復 慕粉3377762
你彈出的是Student的原型,原型被賦值了,值為對象,所以彈出[object]。
舉報
由淺入深學習JS語言特性,且解析JS常見誤區(qū),從入門到掌握
4 回答Student.prototype=new Person() 輸出結果
2 回答Student.prototype = new Person是不是也可以呢
2 回答Student.prototype = Object.create(Person.prototype); Student.prototype.constructor = Person
4 回答請問 var obj = new Object; 和 var obj = new Object(); 的區(qū)別是什么?
5 回答為什么不是Student = Object.create(Person);和Student.prototype = Object.create(Person.prototype);有什么區(qū)別
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學習伙伴
掃描二維碼關注慕課網(wǎng)微信公眾號
2016-07-26
你的是賦值操作,不是判斷操作。
你的意思是想讓Student構造函數(shù)繼承Person
Student.prototype=new Person();
相當于改寫默認的Student.prototye
讓Student.prototype指向new Person()的實例
2016-07-13
你彈出的是Student的原型,原型被賦值了,值為對象,所以彈出[object]。