数组快速生成、赋值的方法
2017-04-26 本文已影响0人
饥人谷_風逝
Array.apply(null,{length:10}).map(()=>1)
Array.from({length:10}).map(()=>1)
Array.from(arrayLike, x => x * x)
Array.from([1, 2, 3], (x) => x * x)
Array.apply(null,{length:10}).map(()=>1)
Array.from({length:10}).map(()=>1)
Array.from(arrayLike, x => x * x)
Array.from([1, 2, 3], (x) => x * x)