1. new Array(101).join(0).split(' ');
2. Array.apply(null, { length: 100 }).fill(0);
3. Array(100).fill(0);
4. var arr = new Array(100);arr = arr.map(item=>0);
5. [...Array(100).fill(0)];
6. 用 lodash. _.fill(Array(100), 0);
7. Array.from({length: 100}, _ => 0)
8. With ES6: Array.prototype.fill()
---------------------
作者:Yveda_csdn
来源:CSDN
原文:https://blog.csdn.net/yveda_csdn/article/details/82743798
版权声明:本文为博主原创文章,转载请附上博文链接!