JavaScript Array.prototype.some() Method
The some() method checks whether at least one element of an array passes a test, returning true or false.
Description
The some() method tests whether at least one element passes the callback's test. It stops and returns true as soon as it finds one, and returns false if none do (always false for an empty array).
It's ideal for checks like "is any item out of stock?". To check for an exact value, includes() is simpler.
Because it stops at the first match, some() is efficient for large arrays where a match is likely to be found early. Empty slots are skipped. Together with every(), it expresses "any" and "all" checks clearly; !arr.some(fn) means "none of the elements match".
Syntax
array.some(callbackFn)
array.some(callbackFn, thisArg)Parameters
- callbackFnA function called for each element, receiving
element,indexandarray. - thisArgOptional. A value to use as
thisinsidecallbackFn.
Return Value
true if the callback returns a truthy value for at least one element, otherwise false.
Example
Browser Support
The following information will show you the current browser support for the Array.prototype.some() method. Hover over a browser icon to see the version that first introduced support for this method.
Desktop





Tablets & Mobile





