Reference / JavaScript
Array.prototype.some()
Tests whether at least one element in the array passes the test implemented by the provided function.
Syntax
some(predicate: (value: T, index: number, array: T[]) => boolean): booleanParameters
| Name | Type | Description |
|---|---|---|
| predicate | Function | Condition tester function. |
Examples
Check if any item is even
const nums = [1, 3, 5, 8];
const hasEven = nums.some(n => n % 2 === 0);
console.log(hasEven); // trueReturns false for any condition on an empty array.