我试图像这样分开数组:
var cars = ['2022-12-1', '2022-12-2', '2022-12-3', '2022-12-4'];
for(var i = 0; i < cars .length; i++){
cars = cars [i];
console.log(cars )
}
返回第一个日期,但我希望它像这样返回所有日期:
2022-12-1
2022-12-2
2022-12-3
2022-12-4
我想把数组分开,这样我就可以给天数编号
let cars = ['2022-12-1', '2022-12-2', '2022-12-3', '2022-12-4'];
for (let i = 0; i < cars.length; i++) {
console.log(cars[i]);
}