i have two arrays ( busns and pc ) i want to check pc array -> pcid is match with busns array -> pcid after match i want to return pcname. final output is comming but i want to avoid duplicate. thanks in advance
please check my attempt in jsfiddle
const busns = [
{
 id:1,
 shopname:'New trend',
 pcid:1
},
{
 id:2,
 shopname:'Latest Beauty',
 pcid:2
},
{
 id:3,
 shopname:'Mens Style',
 pcid:1
},
{
 id:4,
 name:'Fabulook',
 pcid: 1
},
{
 id:4,
 name:'New cut',
 pcid: 2
}
]
const pc = [
       {
         pcid:1,
         pcname: 'collection1'
       },
       {
         pcid:2,
         pcname: 'collection2'
       },
       {
         pcid:3,
         pcname: 'collection3'
       },
       {
         pcid:4,
         pcname: 'collection4'
       }
    ]
My code :
busns.map(busns => {
  return pc.filter( p => {
     return busns.pcid == p.pcid
  }).map(data => {
     console.log(data.pcname)
  })
})
expected output while using console :
collection1
collection2
 
     
    