I need to find the elements in a first array that match with elements in a second array. For example:
this.languages = [
{id: 'es', name: 'Español'},
{id: 'fr', name: 'Frances'},
{id: 'en', name: 'Ingles'},
{id: 'pt', name: 'Portugues'}
];
Must return the languages that match win the next array:
this.languagesSelected = [
'es', 'fr'
];
The result will be:
this.languages = [
{id: 'es', name: 'Español'},
{id: 'fr', name: 'Frances'}
];
Tryng from :
questions.filter(x => x.id === id);
questions.find(x => x.id === id);
I cant compare the second array.
Thanks mates