You don't know JS skills

浮点数取整
const a = 123.222
parseInt(a);
Math.floor(a);
a | 0;
a >> 0
~~a
随机生成10位字符串
Math.random().toString(36).substr(2,10)
不用循环递归实现一个递增数组
Array.apply(null,{length:5}).map((item,index) => index)
Array(5).fill().map((item,index) => index)
Array.from({ length: 5 }, (v, index) => index)
// [0,1,2,3,4]

你可能感兴趣的:(You don't know JS skills)