const persons = [ {firstName: "Lebron", lastName: "James"}, {firstName: "Magic", lastName: "Johnson"}, {firstName: "Wilt", lastName: "Chamberlin"}, {firstName: "Kevin", lastName: "Durant"}, {firstName: "Stephen", lastName: "Curry"} ]; const player1 = persons.find(person => person.firstName === "Magic"); console.log(player1); // outputs {firstName: "Magic", lastName: "Johnson"} const player2 = persons.find(person => person.lastName === "Curry"); console.log(player2); // outputs {firstName: "Stephen", lastName: "Curry"}
Найти объект внутри массива в Javascript
schedule
16.02.2024