I have an object:
a = {
"1": "abc",
"2": "def",
"3": "ghi",
"4": "jkl"
}
and an array:
b = ['abc','ghi']
I want to get keys from the objects which values are in an array and place them in another array, so expected output is: ['1', '3']
.
I have no idea how to filter object properties. I tried mapping an array and get values but I get undefined.
const result = b.map(v => a[v])