Reduce (javascript)

Reduce sums up all the items in the array where the first parameter is the callback and second param is the starting value.

Let’s group grades into an object: