find() and findIndex()
let people = [
{ id: 1, name: "Alice" },
{ id: 2, name: "Bob" },
{ id: 3, name: "Charlie" }
];
// find: Returns first element that passes test
let bob = people.find(person => person.name === "Bob");
console.log(bob); // { id: 2, name: "Bob" }
// findIndex: Returns index of first element that passes test
let charlieIndex = people.findIndex(person => person.name === "Charlie");
console.log(charlieIndex); // 2