how to add up all numbers in an array

JavaScript
const numbers = [10, 20, 30, 40] 
add = (a, b) =>  a + b
const sum = numbers.reduce(add)var numbers = [10, 20, 30, 40] 
var sum = 0;
for (var i = 0; i < numbers.length; i++) {  sum += numbers[i]}
Source

Also in JavaScript: