ITeye博客

JS-Boolean

mingren135 · 2013-03-21 22:56 · Javascript · Web前端 · Markdown

Boolean Values

The following values convert to and therefore work like false:

 All other values,including all objects(and arrays) convert to and work like true.

You can test explicitly to see if a is non-null with an if statement like this

if(a!==null)...

 and you can test to see if a is falsy or truthy value

if(a)...

 In the first case, the body of the if will be executed only if a is not null.The second case if less strict:it will execute the body of the if only if a is not false or any falsy value.

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。