null:通常代表找不到

undefined :通常代表尚未定義

99 =="99" →true

NaN ! = NaN

NaN必須用函式 isNaN()來判斷,但他只能判斷數值,其他都會返回true。

"1" == trure → "1" == 1 → 1 == 1 → true

1 == "" → 1 ==0 → false

undefined==null → true

 

3 + "4" → "34"

3 * "4" → 12

80 / "10" → 8

"10" - 5 → 5

五種falsey狀態也就是說其他東西都是truthy狀態:

  1. undefined
  2. null
  3. 0
  4. ""
  5. NaN

Ex for Truthy : if([]) if("adsaf") if (Math) →這些都是true

arrow
arrow
    全站熱搜

    Deyu 發表在 痞客邦 留言(0) 人氣()