sum variable was never used in this 'forEach' Callback function that is why it never got updated, which means output should be 1,2,3,4,5,0. However, There is no necessary to use sum variable in it to understand the 'forEach' callback function.
I hope it is helpful.
Thank You