📜  对于每个数组 javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:56.902000             🧑  作者: Mango

代码示例6
var fruits = ["apple", "orange", "cherry"];
fruits.forEach(getArrayValues);

function getArrayValues(item, index) {
  console.log( index + ":" + item);
}
/*
result:
0:apple
1:orange
2:cherry
*/