let colors = ['red', 'blue', 'green']; // idx and sourceArr optional; sourceArr == colors colors.forEach(function(color, idx, sourceArr) { console.log(color, idx, sourceArr) });