I have two arrays, first containing objects and second containing ids. I want to return a new array from the first array that has ids from the first array. What is the best and efficient way to do this?
const firstArr = [{id: 1, city: London}, {id: 5, city: 'Berlin'}, {id: 10, city: 'Paris'}, {id: 2, city: 'Rome'}]
const secondArr = ['2', '5']
const wantedArr = [{id: 2, city: 'Rome'}, {id: 5, city: 'Berlin'}]