Array.from创建指定长度的数组,map生成新内容的数组
const arr = Array.from({ length: 10 });
console.log(arr); //[undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined]
const arr2 = arr.map((item) => 1);
console.log(arr2); //[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]