const arrayWithOnes = Array.from({ length: 4 }, () => 1); console.log(arrayWithOnes); // 输出:[1, 1, 1, 1]
Array.from({length:4}) [undefined, undefined, undefined, undefined]