I have the following array:
const HEROES = [
{ id: 1, name: 'Captain America', squad: 'Avengers' },
{ id: 2, name: 'Iron Man', squad: 'Avengers' },
{ id: 3, name: 'Spiderman', squad: 'Avengers' },
{ id: 4, name: 'Superman', squad: 'Justice League' },
{ id: 5, name: 'Wonder Woman', squad: 'Justice League' },
{ id: 6, name: 'Aquaman', squad: 'Justice League' },
{ id: 7, name: 'Hulk', squad: 'Avengers' },
];
I'm trying to pass another object { id: 5, squad: 'Justice League' } into the array to find the matching object.
for example:
findOne(HEROES, { id: 5, squad: 'Justice League' })
should return
{ id: 5, name: 'Wonder Woman', squad: 'Justice League' }
I'm not sure how to start this, any help would be appreciated.