摘要:
在js逻辑运算中,0、""、null、false、undefined、NaN都会判为false,其他都为true 阅读全文
摘要:
console.log( typeof 5);console.log(typeof !!5);log结果:numberboolean 看到很多代码if(!!attr),为什么不直接写if(attr);其实这是一种更严谨的写法:请测试 typeof 5和typeof !!5的区别。!!的作用是把一个其他类型的变量转成的bool类型。 阅读全文
摘要:
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 阅读全文
摘要:
touchTimeout&&clearTimeout(touchTimeout)等价于if(touchTimeout){clearTimeout(touchTimeout)} 阅读全文