let result = 0; [1,2,3,4,5,6].forEach((n) => { if (n % 2 === 0) { result += n * n; } }); console.log(result);