Function Updated 17 Oct 2026
Array.find(filter)
Returns the first item for which the function returns a truthy value.
Parameters
filterfunctionrequiredFunction 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);
}#The template above produces this output:
item twoThe data the example runs with:
{
"items" : [{ "id" : 1, "name" : "item one"}, {"id" : 2, "name" : "item two"}]
}