Array.every
Array.every
Function
Determine whether all elements in the array have a callback result of true.
Syntax
array.every(callback)
Parameters
| Parameters | Type | Required | Default value | Description |
|---|---|---|---|---|
| callback | Fn | No | Empty | The callback signature is fn(value, index, current). |
Return value
| Type | Description |
|---|---|
| Bool | Returns true if all are true, false otherwise. |
Example
items = [2, 4, 6] result = items.every(fn(value) { value % 2 == 0 }) // Output: true print result
Notes
- Returns true for an empty array.