['fish', 'cat', 'dog'].forEach(function (element, index, array) { console.log('In [' + array + '] the ' + index + ' index contains ' + element); }); //above logs //In [fish,cat,dog] the 0 index contains fish //In [fish,cat,dog] the 1 index contains cat //In [fish,cat,dog] the 2 index contains dog