How to filter out from a list of items

Here is the code.

const a="144466,122332";
    

At first I am converting string of numbers into array of integers.

const b= a.split(',').map(i=>parseInt(i,10));

const c=[{id:144466,name:'abc'},
         {id:122332,name:'efg'},
         {id:13366,name:'xyz'}]

Now I am applying filter.

c.filter(c.id===b).map(item=><p>{item.name}</p>)

But I am not getting the result.

78 thoughts on “How to filter out from a list of items”

Leave a Comment