== 與 != 會先進行型別轉換;=== 與 !== 則不轉換。
false 為 0,true 為 1。valueOf() 取得基本型別。null 與 undefined 相等。NaN 與任何值都不相等,包括 NaN 本身。null == undefined // true "5" == 5 // true false == 0 // true NaN == NaN // false
undefined == null // true undefined === null // false
在需要嚴謹比較時,建議優先使用 === 與 !==,避免型別轉換造成錯誤。