亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

修改原型對象的問題

修改原型對象的問題

至尊寶的傳說 2018-09-13 05:37:11
            function Person(name,age){                this.name=name;                this.age=age;                this.getName=function(){                    console.log(this.name);                }            }            Person.prototype.sayAge="hehe";            var p = new Person("lucy","21");            console.log(1,p instanceof Person);            console.log(2,p.constructor === Person);            console.log(3,p.hasOwnProperty('getAge'),p.sayAge);            Person.prototype={                getAge:function(){                    alert(this.age);                }            }            var d = new Person("lucy","21");            console.log(1,d instanceof Person);            console.log(2,d.constructor === Person);            console.log(3,d.hasOwnProperty('getAge'),d.sayAge);                                                如上,不知哪位能給出圖形描述此題中原型鏈指向的情況~~~
查看完整描述

1 回答

?
茅侃侃

TA貢獻1842條經驗 獲得超22個贊

https://img1.sycdn.imooc.com//5bc9406b0001812c06210681.jpg

查看完整回答
反對 回復 2018-10-19
  • 1 回答
  • 0 關注
  • 531 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號