When it comes to array built-in functions, such as reduce and map, the main advantage is the ability to chain them together.
For example, let's say you want to find the sum of elements in an array:
const array = [1, 2, 3];
Aside from chaining methods, is there any other benefit to using:
const sum = array.reduce((prev, next) => prev + next, 0)
instead of a traditional for loop like this:
let sum = 0;
for (let i = 0; i < array.length; i++) sum += array[i];
What do you think?