Ad
  • Custom User Avatar

    I was thinking the same thing... I think that it's because: "Your reducer function's returned value is assigned to the accumulator, whose value is remembered across each iteration throughout the array, and ultimately becomes the final, single resulting value." So, even though prev is never explictly reassigned, each time it hits return whatever is returned there is assigned to prev for the next time it iterates through the array.