Why does Array.prototype.every return true on an empty array?

See the docs

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.)

As an edit, because I looked Vacuous truth up. I understood it from context, but I was interested in the formal definition. This paraphrased quote exemplifies the meaning:

“You are my favorite nephew” is a vacuous statement if he is the only nephew: there are no others to consider.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)