JavaScriptArraysome

Tests whether at least one element passes the provided function.

Syntax

arr.some(callbackFn)

Example

Enter values below to update the example in real time.

const
numbers
hasEven
console
const numbers = [1, 3, 5, 7, 8];
const hasEven = numbers.some((n) => n % 2 === 0);
console.log(hasEven);   // true