(美)David Flanagan. JavaScript權(quán)威指南(原書第6版) (Kindle 位置 1682-1684). Kindle 版本.嚴(yán)格相等運(yùn)算符“===”首先計(jì)算其操作數(shù)的值,然后比較這兩個(gè)值,比較過程沒有任何類型轉(zhuǎn)換: ·如果兩個(gè)值類型不相同,則它們不相等。 ·如果兩個(gè)值都是null或者都是undefined,則它們不相等。我的理解null === null ,應(yīng)該返回 true。在Chrome中實(shí)驗(yàn)代碼console.log(" undefined === undefined, is that true? " + (undefined === undefined));console.log(" null === null, is that true? " + (null === null));返回結(jié)果undefined === undefined, is that true? truenull === null, is that true? true請(qǐng)問是書上寫錯(cuò)了?
JavaScritp犀牛書有錯(cuò)誤? null === null 書上說不相等。
猛跑小豬
2018-12-21 19:14:17