Version 1
From MDN Docs for Array#reduce
The first time the callback is called, previousValue and currentValue can be one of two values. If initialValue is provided in the call to reduce, then previousValue will be equal to initialValue and currentValue will be equal to the first value in the array.
In version #1, the initialValue is provided. So, According to the Docs, previousValue is assigned as the initialValue
So, for the first iteration:
previousValue = initialValue
previousValue = 0
And nextValue is the first element in the array.
nextValue = '##'
So, the returned value 2.
Version 2self-explanatory
If the array is empty and no initialValue was provided, TypeError would be thrown. If the array has only one element (regardless of position) and no initialValue was provided, or if initialValue is provided but the array is empty, the solo value would be returned without calling callback.