Learnlog

Learnlog

1151 bookmarks
Custom sorting
How to find the sum of an array of numbers
How to find the sum of an array of numbers
const sum = [1, 2, 3].reduce(add, 0); // with initial value to avoid when the array is empty function add(accumulator, a) { return accumulator + a; }
·stackoverflow.com·
How to find the sum of an array of numbers