foreach add object into array javascript code example
Example: javascript foreach syntax
const marks = [12, 17, 14];
let sum = 0;
marks.forEach(mark => {
sum += mark;
});
const marks = [12, 17, 14];
let sum = 0;
marks.forEach(mark => {
sum += mark;
});