Q1為什么控制臺(tái),最后輸出了兩個(gè)undifined?var a = { b: { m: function() { console.log(this.p); }, p: 'Hello' }};var hello = a.b.m;hello()Q2感覺(jué)這里也是多了一個(gè)undifined//代碼var a = { b: { m: function() { console.log(this.p);
}, p: 'Hello'
}
};var hello = a.b;
hello.m();補(bǔ)充:?jiǎn)栴}來(lái)源:阮一峰的JS標(biāo)準(zhǔn)里this關(guān)鍵字上面代碼就是鏈接里,2.(3)對(duì)象的方法 最后一段
使用對(duì)象的方法,為什么控制臺(tái)結(jié)果里,多了一個(gè)undifined?
蕪湖不蕪
2018-11-21 17:13:36