cara menambahkan semua angka dalam array
var numbers = [10, 20, 30, 40]
var sum = 0;
for (var i = 0; i < numbers.length; i++) { sum += numbers[i]}
TechWhizKid
var numbers = [10, 20, 30, 40]
var sum = 0;
for (var i = 0; i < numbers.length; i++) { sum += numbers[i]}
const numbers = [10, 20, 30, 40]
add = (a, b) => a + b
const sum = numbers.reduce(add)