Reduce is one of the methods to traverse the arrays.
It will be used to return the reduced single value of the array.
It will take callback and a default value of the accumulator as input.
- Syntax:
const value = Array.reduce((accumulator, elementOfArray) => { return // value; }, defaultValueForAccumulator);