Answers for "for..of"

1

for..of

let colors = ['Red', 'Green', 'Blue'];

for (const [index, color] of colors.entries()) {
    console.log(`${color} is at index ${index}`);
}Code language: JavaScript (javascript)
Posted by: Guest on July-06-2021

Browse Popular Code Answers by Language