How to loop an array?
const words = ['Hallo Welt', 'Nani?', '42']
// output: Hallo Welt 0, Nani? 1, 42 2
words.forEach((word, index, array) => {
console.log(word, index)
})
September 6th, 2019
Provide forEach()
a callback function and it will apply it on each element in ascending order.