📅  最后修改于: 2022-03-11 15:01:31.545000             🧑  作者: Mango
function sum(numbers){
var x = numbers.reduce(function(prev,curr){
return curr + prev;
},0);
return x;
}
alert(sum([1,2,3]));
alert(sum([]));