JavaScript 真值表

阅读 2323
收藏 26
2016-12-29
原文链接:thomas-yang.me

Oh My Dear JavaScript

Bizarre behaviors in JavaScript

Relational and Equality Operators

Operators are ordered by strictness, top most.nullundefinedfalse"false"Boolean(false)[][[]]""String("")0Number(0)"0"String("0")[0]true"true"Boolean(true)1Number(1)"1"String("1")[1]-1Number(-1)"-1"String("-1")[-1]Infinity-InfinityObject()NaNnullundefinedfalse"false"Boolean(false)[][[]]""String("")0Number(0)"0"String("0")[0]true"true"Boolean(true)1Number(1)"1"String("1")[1]-1Number(-1)"-1"String("-1")[-1]Infinity-InfinityObject()NaN=====>= && <=>=<=else

What goes through If statement

# Because strait is the gate, and narrow is the way nullundefinedfalse"false"Boolean(false)[][[]]""String("")0Number(0)"0"String("0")[0]true"true"Boolean(true)1Number(1)"1"String("1")[1]-1Number(-1)"-1"String("-1")[-1]Infinity-InfinityObject()NaNwhat goes through ifwhat equals (==) truewhat equals (==) false
评论