The type of elements in the array
Boolean indicating if any element satisfies the condition
const numbers = [1, 3, 5, 7, 8, 9];
const products = [
{ name: 'Apple', price: 100, inStock: true },
{ name: 'Banana', price: 50, inStock: false },
{ name: 'Orange', price: 80, inStock: true }
];
const hasEvenNumber = ArrayUtil.has(numbers, num => num % 2 === 0);
console.log(hasEvenNumber); // true (8 exists)
const hasExpensiveItem = ArrayUtil.has(products, product => product.price > 90);
console.log(hasExpensiveItem); // true (Apple costs 100)
const hasOutOfStock = ArrayUtil.has(products, product => !product.inStock);
console.log(hasOutOfStock); // true (Banana is out of stock)
Checks if at least one element in the array satisfies the given condition.
Similar to JavaScript's native some() method. Returns true immediately when the first element satisfying the condition is found.