0

I have below sample array which hold nothing but key of object. And I have one object which hold key value pair, so how we can filter the object key based on value present as key in Array?

const arr = ['A', 'B', 'C', 'D', 'E'];
const obj = {
  A: 'test1',
  B: 'test2',
  F: 'test3',
  G: 'test4'
}

expected o/p

{
  A: 'test1',
  B: 'test2',
}
isherwood
  • 58,414
  • 16
  • 114
  • 157
Raj
  • 33
  • 5
  • I've added links to the duplicate list which may help. This topic is extremely well covered on SO, so search if you need more help. – isherwood Jul 26 '23 at 13:31
  • It looks like the duplicates do cover your problems. However, if you still think your problem differentiates from the linked posts, edit your question and make clear to us what is different. – Wimanicesir Jul 26 '23 at 14:05

0 Answers0