JavaScript Array some() Method

Beginner
⏱️ 8 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Boolean test

What You’ll Learn

The some() method checks whether at least one array element passes a test function and returns true or false. This tutorial covers callback syntax, short-circuiting, empty-array behavior, comparison with every(), and five practical examples.

01

Syntax

some(fn)

02

Any pass

true / false

03

Short-circuit

Stops early

04

Empty []

false

05

vs every

ANY vs ALL

06

ES5

Wide support

Introduction

Need a yes/no answer: “Is anyone over 18?” “Does any product cost more than $100?” “Is any field filled in?” some() walks the array until one element makes your callback return a truthy value—then it stops and returns true.

If no element passes, you get false. The array itself is not modified.

Understanding the some() Method

array.some(callback, thisArg?) calls callback(element, index, array) for each element until the callback returns a truthy value (then some returns true) or every element is tested (then returns false).

For simple exact-value checks, includes() may be enough. Use some() when you need custom logic—comparisons, object properties, or compound conditions.

💡
Beginner Tip

Return a boolean from your callback (or a value that coerces to true/false). Avoid side effects like console.log inside the test unless you are debugging—keep callbacks pure for clarity.

📝 Syntax

General form of Array.prototype.some:

JavaScript
array.some(callback(element, index, array), thisArg)

Parameters

  • callback — function returning truthy if the element passes.
  • thisArg — optional this value inside the callback.

Return value

  • true if at least one element passes.
  • false if none pass (including empty arrays).

Common patterns

  • arr.some((n) => n > 10) — any number greater than 10.
  • users.some((u) => u.active) — any active user.
  • fields.some((f) => f.trim() !== "") — any non-empty field.
  • if (arr.some(predicate)) { ... } — guard logic.

⚡ Quick Reference

QuestionMethod
Does ANY pass?arr.some(fn)
Do ALL pass?arr.every(fn)
Exact value exists?arr.includes(val)
Empty arraysome → false
Mutates array?No

📋 some() vs every() vs includes() vs find()

Pick based on ANY vs ALL vs exact match vs returning the item.

some
any pass?

Boolean

every
all pass?

Boolean

includes
exact value

Boolean

find
first match

Element

Examples Gallery

Open DevTools Console (F12) or use Try-it labs. Example N maps to ?tryit=N.

📚 Getting Started

Basic predicate tests on numbers.

Example 1 — At Least One Element Passes

Check if any number is greater than 30.

JavaScript
const numbers = [10, 20, 30, 40, 50];

const hasAbove30 = numbers.some((num) => num > 30);

console.log(hasAbove30);
// true
Try It Yourself

How It Works

40 and 50 pass the test. some stops at 40 (index 3) and returns true without checking 50.

Example 2 — Returns false When None Match

Every callback return is falsy, so the result is false.

JavaScript
const numbers = [10, 20, 30, 40, 50];

const hasAbove100 = numbers.some((num) => num > 100);

console.log(hasAbove100);
// false
Try It Yourself

How It Works

The callback runs for every element because none pass. Final result: false.

📈 Practical Patterns

Edge cases, logical opposites, and object tests.

Example 3 — Empty Array Returns false

Opposite of every(), which returns true on [].

JavaScript
const empty = [];

console.log(empty.some((n) => n > 0));
// false

console.log([].every((n) => n > 0));
// true (for comparison)
Try It Yourself

How It Works

With zero elements, there is no witness that passes the test, so some returns false.

Example 4 — some() vs every()

Same array, different questions.

JavaScript
const scores = [80, 92, 76, 88];

const anyFail = scores.some((s) => s < 70);
const allPass = scores.every((s) => s >= 70);

console.log("any below 70?", anyFail);
// false

console.log("all at least 70?", allPass);
// true
Try It Yourself

How It Works

some looks for one failure (score < 70). every requires all scores to pass the threshold.

Example 5 — Test Object Properties

Check if any user has the admin role.

JavaScript
const users = [
  { name: "Alice", role: "editor" },
  { name: "Bob", role: "viewer" },
  { name: "Carol", role: "admin" }
];

const hasAdmin = users.some((user) => user.role === "admin");

console.log(hasAdmin);
// true
Try It Yourself

How It Works

Carol matches at index 2. some returns true without scanning further (though only one admin exists here).

🚀 Common Use Cases

  • Validation — any required field filled.
  • Permissions — any user is admin.
  • Inventory — any item out of stock.
  • Threshold checks — any score above a limit.
  • Feature flags — any enabled option in a list.
  • Guard clausesif (arr.some(...)) early logic.

🧠 How some() Runs

1

Start at index 0

Empty array? Return false immediately.

Init
2

Call callback

Pass element, index, and array.

Test
3

Truthy? Stop

Return true on first pass.

Short-circuit
4

Or return false

No element passed the test.

📝 Notes

  • Returns a boolean, not an element (use find for that).
  • Short-circuits on first truthy callback result.
  • Empty array → false.
  • Does not mutate the array.
  • Skips empty holes in sparse arrays (no callback for holes).
  • For exact values, includes() may be simpler.
  • ES5—excellent support including IE9+.

Browser & Runtime Support

Array.prototype.some() has been available since ES5 (2009), alongside every(), filter(), and forEach().

Baseline · ES5

Array.prototype.some()

Supported in Chrome 5+, Firefox 2+, Safari 3+, Edge (all versions), IE 9+, and all modern Node.js versions.

99% Universal support
Google Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Bun Supported · JavaScript runtime
Supported
Deno Supported · JavaScript runtime
Supported
Node.js Supported · Server runtime
Supported
Android WebView Supported · Modern WebView
Full support
Array.some() Excellent

Bottom line: Safe to use everywhere except very old IE8 environments. No polyfill needed for modern projects.

Conclusion

some() answers “does at least one element pass?” with a boolean. It short-circuits for efficiency and pairs logically with every() for ALL vs ANY tests.

Next, learn sort() to reorder array elements.

💡 Best Practices

✅ Do

  • Return clear booleans from callbacks
  • Use for ANY-exists checks with custom logic
  • Prefer includes for simple value membership
  • Pair mentally with every (opposite question)
  • Keep callbacks side-effect free

❌ Don’t

  • Use some when you need the matching element (find)
  • Assume empty arrays return true
  • Put heavy work in callbacks after a match is found
  • Mutate the array inside the test callback
  • Confuse some with filter (returns array)

Key Takeaways

Knowledge Unlocked

Five things to remember about Array.some()

Test if any element satisfies your condition.

5
Core concepts
02

Any pass

true / false.

Result
03

Short-circuit

Stops early.

Perf
04

Empty []

false.

Edge
05

vs every

ANY vs ALL.

Pair

❓ Frequently Asked Questions

some() tests whether at least one element in an array passes a callback function. It returns true if any callback return is truthy; otherwise it returns false.
No. some() only reads elements through your callback. It does not change the array unless your callback mutates it deliberately (which is discouraged).
An empty array always returns false. There are no elements that can pass the test.
Yes. some() short-circuits—it stops calling the callback as soon as one element returns a truthy value and immediately returns true.
some() asks 'does ANY pass?' and returns true on the first success. every() asks 'do ALL pass?' and returns false on the first failure. They are logical opposites for array testing.
some() has been available since ES5 (2009). It works in all modern browsers, Node.js, and Internet Explorer 9+.
Did you know?

In logic, some() is like existential quantification (“there exists”) and every() is like universal quantification (“for all”). Empty arrays make some false and every true by definition.

Continue to sort()

Learn how to reorder array elements with a compare function or default sorting.

sort() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

6 people found this page helpful