how reduce works in ?

const initValue = 0 const values = [ 3, 5, 1, 4, 2 ] const total = values.reduce(( acc, item ) => { return acc + item }, initValue)
view source code on github