calculer la somme dans un tableau vide javascript

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