Calls a function for all the elements in a typed array. The return value of the function is the accumulated result, and is provided as an argument in the next call to the callback function.
reduce(callback, initialValue?)
callback function(previousValue, currentValue, currentIndex, array)
A function that accepts up to four arguments. The reduce method calls the callback function one time for each element in the array.
initialValue optional
If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callback function provides this value as an argument instead of an array value.
The accumulated result.
new BigInt64Array([1, 2, 3]).reduce((sum, value) => sum + value, 0)
6