// codewars solution // leetcode solution // and more function sum(arr) { return arr.reduce( (x,y) => x+y, 0); } sum([1, 2, 3, 4]); // 10 sum([2, 4, 1, 3, 5]); // 15 // enjoy :)