摘要: 在js逻辑运算中,0、""、null、false、undefined、NaN都会判为false,其他都为true 阅读全文
posted @ 2013-03-28 16:12 mabel_on_line 阅读(154) 评论(0) 推荐(0) 编辑
摘要: console.log( typeof 5);console.log(typeof !!5);log结果:numberboolean 看到很多代码if(!!attr),为什么不直接写if(attr);其实这是一种更严谨的写法:请测试 typeof 5和typeof !!5的区别。!!的作用是把一个其他类型的变量转成的bool类型。 阅读全文
posted @ 2013-03-28 16:11 mabel_on_line 阅读(799) 评论(0) 推荐(0) 编辑
摘要: http://jishuziyuan.com/archive/shaenxing2/6341238.html<script>if(1 == true){ console.log('1.ture');}else{ console.log('1.false'); }if(1===true){ console.log('2.true'); }else{ console.log('2.false'); }</script>log结果:1.ture 2.false实例http://hi.baidu.com/songz 阅读全文
posted @ 2013-03-28 15:56 mabel_on_line 阅读(292) 评论(0) 推荐(0) 编辑
摘要: touchTimeout&&clearTimeout(touchTimeout)等价于if(touchTimeout){clearTimeout(touchTimeout)} 阅读全文
posted @ 2013-03-28 15:46 mabel_on_line 阅读(257) 评论(0) 推荐(0) 编辑