Noob javascript enthusiast here.
I'm trying to understand the various higher-order functions of javascript, and am particularly curious with the possibilities of .map() on an array of objects.
Suppose you have the following:
selectedId = ['u1', 'u2']
data = [
{id: 'u1', color: 'red', age: '24'},
{id: 'u2', color: 'blue', age: '18'},
{id: 'u3', color: 'yellow', age: '15'}
]
How would you go about creating a new array that only contains the object of u1 and u2? I.e:
selectedData = [
{id: 'u1', color: 'red', age: '24'},
{id: 'u2', color: 'blue', age: '18'},
]