2023-01-19 Vue fill(填充數據,位置開始,結束) fill(填充數據,位置開始,結束) const array1 = [1, 2, 3, 4]; //從位置 2 到位置 4 填充 0 console.log(array1.fill(0, 2, 4)); //[1,2,0,0] //從位置 1 填充 5 console.log(array1.fill(5, 1)); //[1,5,5,5] //填充6 console.log(array1.fill(6)); // [6, 6, 6, 6] Newer some():至少一個元素符合... Older concat():合併兩個或多個數組