some vs every in JavaScript — and why an empty list is "all done"

A new user opens your task tracker. They don't have any tasks yet. And the screen shows confetti and "All tasks done, great job!".
An AI wrote the code, and it looks flawless:
if (tasks.every(t => t.done)) showConfetti()
We checked: [].every(t => t.done) returns true. To every, an empty list is "all done". It's not a JavaScript bug, it's math. Let's see how some and every work, how they differ, and where each one trips you up.
What some and every do
Both methods ask an array a question and answer true or false — a boolean.
some asks: "is there at least one like this?"
[3, 8, 1].some(n => n > 5) // true — the 8 fits
every asks: "are they all like this?"
[3, 8, 1].every(n => n > 5) // false — the 3 doesn't fit
Picture a check at the door. some is a guard who's happy with one ticket per group. every is an inspector who checks everyone's ticket.
Comparison on five criteria
1. The question it asks.
some— "at least one?". Like the word "or": the first fits, or the second, or the third.every— "every single one?". Like the word "and": the first and the second and the third.
2. When it stops.
some— on the firsttrue. Found a match — it looks no further.every— on the firstfalse. Found a misfit — the answer is already clear.
This matters if the callback has a side effect. We checked: [1, 2, 3].some(...) looking for a 2 called the function only for 1 and 2. It never touched the 3.
3. What it returns on an empty array.
some—false. No items — so no matching item either.every—true. No items — so no non-matching item either. Logicians call this "vacuous truth".
4. How they relate. They're mirror twins. "Not all done" is the same as "at least one isn't done":
!tasks.every(t => t.done) === tasks.some(t => !t.done) // always
Pick whichever form reads like a normal sentence.
5. How they differ from their neighbors.
includeschecks for a specific value:ids.includes(7). You needsomewhen the condition is more complex or there are objects inside:users.some(u => u.id === 7).filterandfindreturn the items themselves.someandeveryreturn only yes or no. If you don't need the item, just the answer, use them: they don't build an extra array.
The empty-array trap in practice
Back to the confetti. "All tasks done" for someone with no tasks is a false congratulation. One length check fixes it:
if (tasks.length > 0 && tasks.every(t => t.done)) showConfetti()
The same trap hides in permission and form checks:
- "All files passed validation" — with zero uploaded files, the form goes out empty.
- "The user has all required permissions" — if the list of required permissions accidentally arrives empty, access opens up.
Every time you write every, ask yourself: "what if the list is empty — do I want that?"
Which one to pick
A verdict without diplomacy:
- Use
somewhen one match is enough: are there errors in the form, is there an item in the cart, is the email taken. An empty list is safe here — an honestfalse. - Use
everywhen you need "every single one": all fields filled, all steps done. But always decide what to do with an empty list, and write it out explicitly. - Use neither if you need the item itself — then it's
findorfilter.
Unsure? Say it out loud. "Is there at least one error?" — that's some. "Are all fields filled?" — that's every plus a length check.
Can I just write a loop?
You can, but some and every are shorter and stop at the right moment on their own. A loop with a flag and break does the same in five lines instead of one. More on choosing in for loop or map.
Do some and every work with await?
No. If the callback is async, it returns a promise, and a promise is always "truthy". some says true on the very first item without waiting for anything. For async checks, gather the results with Promise.all first, then check.
How do I get AI to avoid the trap?
Spell out the empty-list behavior. The model almost never thinks about it on its own.
show confetti when all tasks are doneShow confetti when every task in tasks is done (done: true). If there are no tasks at all, do not show confetti; show an empty state with an Add task button instead. Use every plus an explicit length check.The AI Architect 2027 course: step by step from computer basics to your own app and first customers. 543 short lessons on your phone.





