//生成[item1-item9]数组 Array(9).join(0).split(‘‘).map((item,index) => ‘item‘ + (index+1)) //生成20个对象的数组 Array.apply(null,{length:20}).map(function(item,index){ return {name:‘xxx‘,index:(index+1)}; });
javascript快速产生数组方法
原文:http://www.cnblogs.com/mengff/p/7190340.html