- 博客(1)
- 资源 (5)
- 收藏
- 关注
转载 JS中的“!!”
JS中的“!!”var o={flag:true}; var test=!!o.flag;//等效于var test=o.flag||false; alert(test);由于对null与undefined用!操作符时都会产生true的结果,所以用两个感叹号的作用就在于,如果明确设置了o中flag的值(非 null/undefined/0""/等值),自然test就会取
2014-05-12 09:47:34 429
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人