Array reduce in javascript

broken image
broken image

The reducer function takes two parameters. The first parameter is a function, generally called the reducer, that will be called on each value in the array and the second parameter is the starting value that will be used in your reducer function.

broken image

The reduce method in its simplest form takes two parameters.

broken image

This value could be anything such as a number, object, or string. The reduce method is actually named pretty well since all it does is take an array of elements and reduce that array down to one single value.

broken image