Day: January 6, 2023

  • Using Reduce

    Reduce is used somewhat similar to ‘map’ Zero is set as the initial value and then it goes through the array and adds each value (in this example the currentScore) to the totalScore which becomes the new ‘previousScore’. Here’s a more useful example: