I recently saw an exercise for finding a minimum and maximum value in an array. The wording of the question, which I won’t repeat here, hinted you to do that with a bit story behind it. Then, I reminisced about the good old days and attacking the problem with a simple for loop. You know, the one with a variable defined above the for loop and you keep checking the next value in the for loop against this variable so you could update it if necessary. Luckily, we now have array methods such as forEach, map, filter etc.
Filter and map can’t help us here since we are only interested in one final value than shrinking the said array or converting the array values. ForEach is no different than using plain old for loop really. How about reduce?