2016年6月15日

JS中的“!!”

摘要: var o={flag:true}; var test=!!o.flag;//等效于var test=o.flag||false; alert(test); 由于对null与undefined用!操作符时都会产生true的结果,所以用两个感叹号的作用就在于,如果明确设置了o中flag的值(非 nul 阅读全文

posted @ 2016-06-15 15:59 ranyonsue 阅读(195) 评论(0) 推荐(0) 编辑

导航