美文网首页
You don't know JS skills

You don't know JS skills

作者: 今天的我吃饱了吗 | 来源:发表于2017-08-17 23:11 被阅读0次
浮点数取整
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

      本文链接:https://www.haomeiwen.com/subject/chcorxtx.html