foreach js declare array js code example
Example 1: mdn foreach
arr.forEach(callback(currentValue [, index [, array]])[, thisArg])
Example 2: javascript foreach syntax
const marks = [12, 17, 14];
let sum = 0;
marks.forEach(mark => {
sum += mark;
});