foreach loop index javascript print row code example Example: mdn foreach arr.forEach(callback(currentValue [, index [, array]])[, thisArg])