Accumulation of array elements in loops in JavaScript

Let's use a loop to find the sum of the array elements:

javascriptlet arr = [1, 2, 3, 4, 5];
let res = 0;

for (let elem of arr) {
  res += elem;
}

console.log(res); // the required sum
Задание 1

Given an array:

javascriptlet arr = [2, 5, 9, 3, 1, 4];

Find the sum of the array elements.

Задание 2

Given an array:

javascriptlet arr = [2, 5, 9, 3, 1, 4];

Find the sum of elements that are even numbers.

Задание 3

Given an array:

javascriptlet arr = [2, 5, 9, 3, 1, 4];

Find the sum of the squares of the array elements.

Задание 4

Given an array:

javascriptlet arr = [2, 5, 9, 3, 1, 4];

Find the product of the array elements.