【发布时间】:2014-10-25 18:19:54
【问题描述】:
我已经知道以下行为,但有人能告诉我为什么会这样吗?谢谢。
if("hello"==true)alert("it's true!"); //-> does not fire the alert
if("hello"==false)alert("it's true!"); //-> does not fire the alert
if("hello")alert("it's true!"); //-> fires the alert
【问题讨论】:
-
所有此类问题的答案都可以在in the spec.找到
标签: javascript if-statement operators boolean-logic