我如何 console.log 当前数组中索引 1 到 5 的项目?使用循环
let cars = ["AUDI","BMW","LEXUS","VOLKSWAGEN","FERRARY","PORSCHE"]
const mappedCars=cars.map((item, i) => {
console.log("The current index is: " + i);
console.log("The current element is: " + item);
console.log("\n");
return item; //equivalent to list[index]
});
console.log(mappedCars);
UYOU
月关宝盒
呼唤远方
相关分类