Docly Developers
Function Updated 17 Oct 2026

Array.find(filter)

Returns the first item for which the function returns a truthy value.

Parameters

filterfunctionrequired

Function called with (item, index, array). Return a truthy value for the item you want.

Returns

The first matching item, or null if no item matches (standard JavaScript returns undefined — test with if (!item) to cover both).

Example

Mixed HTML (or any text file) with inline JavaScript between hash signs.
#{
    let item = items.find(x => x.id == 2);
    write(item.name);
}#