forEach index

by ptums

JavaScript

// my example array to execute the forEach method on
const myWebStack = ['JavaScript', 'HTML', 'CSS', 'somtimes PHP', 'sometimes Python', 'sometimes SaSS'];

// executing the forEach method on the array myWebStack
 myWebStack.forEach(function(item, index, array) {
	console.log(index);
});

// the return message is this...

/* 
0
1
2
3
4
5
*/