📜  javascript enumerate with index - Javascript代码示例

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

代码示例1
const iterable = [...];
for (const [index, elem] in iterable.entries()) {
  f(index, elem);
}

// or
iterable.forEach((elem, index) => {
  f(index, elem);
});