Underscore.js _.find() Function (original) (raw)

Last Updated : 14 Jan, 2024

Underscore.js **_.find() function looks at each element of the list and returns the first occurrence of the element that satisfies the condition. If any element of the list does not satisfy the condition then it returns the undefined value.

**Syntax:

_.find(list, predicate, [context])

**Parameters:

**Return value:

It returns the first occurrence of the element that satisfies the condition.

**Example 1: In this example, we are using the Underscore.js _.find() function.

html `

`

**Output: It will be shown in the console.

5

**Example 2: In this example, we are using the Underscore.js _.find() function.

html `