any()

Test if any array element passes the test of the given function.

Signature

any(predicate: () => Boolean | Null): Boolean

Description

The any() method tests if any element passes the test of the given function.

Parameters

Parameter Type Required Description

predicate

Function

Yes

Anonymous Function that applies tests the array elements.

predicate parameters: None

Return value

Type Description

Boolean

Status of predicate applied to every array element:
true = At least one element passes the test.
false = No elements pass the test.

Examples

let iter = [1, 2, 3]
iter.any(v => v == 2)
true

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!