diff --git a/spec.html b/spec.html index 6527368adf..a6a55c1cad 100644 --- a/spec.html +++ b/spec.html @@ -40712,7 +40712,7 @@

Array.prototype.push ( ..._items_ )

Array.prototype.reduce ( _callback_ [ , _initialValue_ ] )

-

_callback_ should be a function that takes four arguments. `reduce` calls the callback, as a function, once for each element after the first element present in the array, in ascending order.

+

_callback_ should be a function that takes four arguments. `reduce` calls _callback_ once for each element present in the array, in ascending order, skipping the first element unless _initialValue_ is provided.

_callback_ is called with four arguments: the _previousValue_ (value from the previous call to _callback_), the _currentValue_ (value of the current element), the _currentIndex_, and the object being traversed. The first time that callback is called, the _previousValue_ and _currentValue_ can be one of two values. If an _initialValue_ was supplied in the call to `reduce`, then _previousValue_ will be _initialValue_ and _currentValue_ will be the first value in the array. If no _initialValue_ was supplied, then _previousValue_ will be the first value in the array and _currentValue_ will be the second. It is a *TypeError* if the array contains no elements and _initialValue_ is not provided.

`reduce` does not directly mutate the object on which it is called but the object may be mutated by the calls to _callback_.

The range of elements processed by `reduce` is set before the first call to _callback_. Elements that are appended to the array after the call to `reduce` begins will not be visited by _callback_. If existing elements of the array are changed, their value as passed to _callback_ will be the value at the time `reduce` visits them; elements that are deleted after the call to `reduce` begins and before being visited are not visited.

@@ -40753,7 +40753,7 @@

Array.prototype.reduce ( _callback_ [ , _initialValue_ ] )

Array.prototype.reduceRight ( _callback_ [ , _initialValue_ ] )

-

_callback_ should be a function that takes four arguments. `reduceRight` calls the callback, as a function, once for each element after the first element present in the array, in descending order.

+

_callback_ should be a function that takes four arguments. `reduceRight` calls _callback_ once for each element present in the array, in descending order, skipping the first call unless _initialValue_ is provided.

_callback_ is called with four arguments: the _previousValue_ (value from the previous call to _callback_), the _currentValue_ (value of the current element), the _currentIndex_, and the object being traversed. The first time the function is called, the _previousValue_ and _currentValue_ can be one of two values. If an _initialValue_ was supplied in the call to `reduceRight`, then _previousValue_ will be _initialValue_ and _currentValue_ will be the last value in the array. If no _initialValue_ was supplied, then _previousValue_ will be the last value in the array and _currentValue_ will be the second-to-last value. It is a *TypeError* if the array contains no elements and _initialValue_ is not provided.

`reduceRight` does not directly mutate the object on which it is called but the object may be mutated by the calls to _callback_.

The range of elements processed by `reduceRight` is set before the first call to _callback_. Elements that are appended to the array after the call to `reduceRight` begins will not be visited by _callback_. If existing elements of the array are changed by _callback_, their value as passed to _callback_ will be the value at the time `reduceRight` visits them; elements that are deleted after the call to `reduceRight` begins and before being visited are not visited.