var numbers = [4, 9, 16, 25]; function myFunction(item, index) { console.log("item:" + item + "__index:" + index); } numbers.forEach(myFunction); console.log("_________________"); for (var i = 0; i < numbers.length; i++) { console.log("item:" + numbers[i] + "__index:" + i); }