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

Inconsistency .reduce reducer counter argument with Array method #242

Closed
zloirock opened this issue Oct 20, 2022 · 1 comment · Fixed by #243
Closed

Inconsistency .reduce reducer counter argument with Array method #242

zloirock opened this issue Oct 20, 2022 · 1 comment · Fixed by #243

Comments

@zloirock
Copy link
Contributor

With #211:

[1, 2].reduce((a, e, i) => console.log(i)); // => 1

[1, 2].values().reduce((a, e, i) => console.log(i)); // => 0
@ljharb
Copy link
Member

ljharb commented Oct 20, 2022

Indeed, the first invocation of a reduce with no initialValue argument must start its "counter" at 1.

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

Successfully merging a pull request may close this issue.

2 participants