📜  for..of - 任何代码示例

📅  最后修改于: 2022-03-11 14:55:41.052000             🧑  作者: Mango

代码示例1
let colors = ['Red', 'Green', 'Blue'];

for (const [index, color] of colors.entries()) {
    console.log(`${color} is at index ${index}`);
}Code language: JavaScript (javascript)