Skip to content
Yasser Moradi edited this page Sep 1, 2015 · 1 revision

Description:

This method returns true if collection has one or more items. It accepts an optional arguments as a predicate. This starts to evaluate for each item. The first item that the predicate returns true for it, then evaluating will be stopped and it returns true.

Sample:

let numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 15, 19];

console.log(numbers.asEnumerable().any());
console.log(empty.asEnumerable().any());

let over10 = numbers.asEnumerable().any(n=> n > 10);
let over20 = numbers.asEnumerable().any(n=> n > 20);

console.log('over 10 => ' + over10);
console.log('over 20 => ' + over20);
Clone this wiki locally