`
mingren135
  • 浏览: 69261 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

JS-Boolean

 
阅读更多

 

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.

 

 

  • 大小: 3.1 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics