LiuL0703 / blog

https://liul0703.github.io
38 stars 11 forks source link

一些JavaScript奇技淫巧 #3

Closed LiuL0703 closed 6 years ago

LiuL0703 commented 6 years ago

使用~~向下取整 类似与Math.floor();

~~12.1  // 12
~~12.7 //12

数组去重

[...new Set(array)]

数组中的最大值

Math.max(...[1,2,3,4,5])    // 5