Note: Calling reduce() on an empty array without an initial value is an error.
Total(required): The previously returned value of the function.
CurrentValue(Required): The value of the current element.
Index(Optional): The index of the current element being processed in the array. Starts at index 0.
Arr(Optional): The array reduce() was called upon.
InitialValue(Optional): A value to be passed to the function as the initial value.
Return the reduced single value of the array.
Java, MongoDB, python, C, RDBMS, C++