What went wrong?

These functions optionally take an initialValue (which will be used as the first argument to the first call of the callback). However, if no initial value is provided, it will use the first element of the Array or TypedArray as the initial value. This error is raised when an empty array is provided because no initial value can be returned in that case.