find()

An Array method that returns the first item satisfying a test.

What does find() do in JavaScript?

find() — An Array method that returns the first item satisfying a test.

const orders = [{ id: 1 }, { id: 2 }];
const order = orders.find(item => item.id === 2);

Level: Journeyman · More JavaScript terms at this level

Updated