Description

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

Syntax

every(array, element, expression)

Parameters

Input ParameterTypeDescription
arrayArrayThe array every() 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
every([1, 2, 3], x, x >= 1)trueCheck if all the elements of an array are greater than 2
every([{'name' : 'John', 'age' : 18},{'name' : 'Raj', 'age' : 25}], x, x.age > 18)falseCheck if all of the user's age is greater than 18

To view all the List functions, click here.