Hitung jumlah dalam javascript array kosong
function sum(numbers){
var x = numbers.reduce(function(prev,curr){
return curr + prev;
},0);
return x;
}
alert(sum([1,2,3]));
alert(sum([]));
Doubtful Dunlin