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

Array.prototype.every() check returns true on an empty array #37150

Closed
marciamoss opened this issue Dec 9, 2024 · 1 comment
Closed

Array.prototype.every() check returns true on an empty array #37150

marciamoss opened this issue Dec 9, 2024 · 1 comment
Labels
Content:JS JavaScript docs

Comments

@marciamoss
Copy link

MDN URL

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every

What specific section or headline is this issue about?

Array.prototype.every()

What information was incorrect, unhelpful, or incomplete?

When array is empty the check returns true for any condition

What did you expect to see?

I would expect a false if there are no elements to satisfy the condition.

Do you have any supporting links, references, or citations?

No response

Do you have anything more you want to share?

No response

MDN metadata

Page report details
@marciamoss marciamoss added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Dec 9, 2024
@github-actions github-actions bot added the Content:JS JavaScript docs label Dec 9, 2024
@Josh-Cena
Copy link
Member

Josh-Cena commented Dec 10, 2024

This is already mentioned on this page.

every acts like the "for all" quantifier in mathematics. In particular, for an empty array, it returns true. (It is vacuously true that all elements of the empty set satisfy any given condition.)

if there are no elements to satisfy the condition.

"Everything satisfies X" does not require "something that satisfies X" to exist. If it helps, understand it as "nothing falsifies X".

@Josh-Cena Josh-Cena closed this as not planned Won't fix, can't repro, duplicate, stale Dec 10, 2024
@Josh-Cena Josh-Cena removed the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:JS JavaScript docs
Projects
None yet
Development

No branches or pull requests

2 participants