1、二级制操作优于Math如://函数向下取整 console.log(Math.floor(8.9)); //二进制向下取整 console.log(8.9>>0);2、慎用||大量运用if(x === null){ x={} } 优于x=x||{}3、swi ...
1、二级制操作优于Math
如:
//函数向下取整 console.log(Math.floor(8.9)); //二进制向下取整 console.log(8.9>>0);
2、慎用||
大量运用if(x === null){ x={} } 优于x=x||{}
3、switch 性能优于if...else if...
原标题:JS 运算、判断优化
关键词:JS
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。