JavaScript foreach argumen ini

const colors = ['blue', 'green', 'white'];
function iterate(item, index, array) {
  console.log(item);
  if (index === array.length - 1) {
    console.log('The last iteration!');
  }
}
colors.forEach(iterate);
// logs "blue"
// logs "green"
// logs "white"
// logs "The last iteration!"
Alive Ape