The find() method locates the first object matching a condition. It returns the object itself, not its index.
const users = [
{ id: 1, name: "Alice" },
{ id: 2, name: "Bob" }
];
const found = users.find(u => u.id === 2);
console.log(found.name); // "Bob"
If no match exists, find() returns undefined.