Standard built-ins

Array.prototype.some()

Try the free JavaScript compiler

Returns true at the first truthy predicate result among present indices. Skips ordinary holes; empty input returns false. Initial length bounds the search.

Formal Syntax & Structure

javascript syntaxjavascript
array.some(predicate, thisArg?)

Parameters & Attributes

NameTypeDescription
callbackfunctionTests whether a value is a witness.
thisArganyOptional this value for ordinary callback functions.

Return Value

boolean

True if at least one present element passes.

Working Example

Example Snippetjavascript
console.log([1,2,8].some(x=>x>5), [].some(x=>true));
JavaScript Reference