Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with "Array.prototype.reduce" and "Array.prototype.reduceRight" #744

Closed
fpelliccioni opened this issue Dec 5, 2016 · 2 comments
Closed

Comments

@fpelliccioni
Copy link

fpelliccioni commented Dec 5, 2016

At 22.1.3.19 Array.prototype.reduce ( callbackfn [ , initialValue ] )

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

The callback function is called N - 1 times, where N is the number of elements in the array (when initialValue is not present).

Same error at 22.1.3.20 Array.prototype.reduceRight ( callbackfn [ , initialValue ] )

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

@getify
Copy link
Contributor

getify commented Dec 5, 2016

The algorithm (below this text) is accurate. This text (slightly misleading in that it's incomplete) is only in the Note 1, which is only informal (aka non-normative) human description.

@littledan
Copy link
Member

@fpelliccioni Nice catch! It'd be a great next step if you want to write a pull request against the spec (in spec.html of this repository) with fixed non-normative text. I really appreciate your help; in my opinion, the non-normative text is a really important part for users and implementers to be able to understand the spec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants