js 运算

1.Math.floor(xxx/2)   =    xxx >> 2

2.数字取整     Math.floor(xxx.xxxx) =  xxx.xxxx | 0

3.整数去掉最后一位   Math.floor(xxxxx/10)      xxxxx/10 | 0

4.字符串 -》 数字    +xxxxx    Number(xxxxx)

5.数字 -》 字符串    xxxx+‘’    xxxx.toString()    String(xxxxx)

6.奇数/偶数判断    num & 1  -》 true  奇数    否则 为偶数      num % 2 -》 true  为奇数 否则为偶数

原文地址:https://www.cnblogs.com/tutao1995/p/12217034.html