get sum of array in js code example Example: js sum of array [1, 2, 3, 4].reduce((a, b) => a + b, 0) // Output: 10