Array.some
Array.some
Function
Determine whether there is an element in the array and make the callback result true.
Syntax
array.some(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 the element exists, false otherwise. |
Example
items = [1, 3, 4] result = items.some(fn(value) { value % 2 == 0 }) // Output: true print result
Notes
- Returns false for an empty array.