Description

Return true if any of the array elements pass the test provided by the expression, otherwise false.

Syntax

some(array, element, expression)

Parameters

Input ParameterTypeDescription
arrayArrayThe array some() was called upon
elementanyThe current element being processed in the array
expressionexpressionA boolean expression to be run for each array element.

Return value

Type
boolean

Sample

ExampleResultDescription
some([1, 2, 3], x, x > 2)trueCheck if at least one element is greater than 2
some([{'name' : 'John', 'age' : 18},{'name' : 'Raj', 'age' : 25}], x, x.age > 18)trueCheck if at least one of the user's age is greater than 18

To view all the List functions, click here.