The problem of object combination in js Array

there are two sets of data
let a = [

{
    brandName: "aaa",
    brandId: "75",
},
{
    brandName: "bbb",
    brandId: "12",
},
{
    brandName: "ccc",
    brandId: "16",
}

]

let b = [

]
{
    voteid: 12,
    totolnumber: 110
},
{
    voteid: 16,
    totolnumber: 220
},
{
    voteid: 100,
    totolnumber: 20
},
{
    voteid: 75,
    totolnumber: 20
}

]

how can you match two id and form a third array?
let c = [

{
    brandName: "aaa",
    brandId: "75",
    totolnumber: 20
},
{
    brandName: "bbb",
    brandId: "12",
    totolnumber: 110
},
{
    brandName: "ccc",
    brandId: "16",
    totolnumber: 220
}

]

Sep.10,2021

how about two loops?
var arr = []
a.map(e=>{
  b.map(o=>{
    if(e.brandId == o.voteid){
      let obj ={
        brandId:e.brandId,
        totolnumber:o.totolnumber,
        brandName:e.brandName
      }
      arr.push(obj)

    }
  })
})
console.log(arr)
//   


clipboard.png


let a = [
  {
    brandName: 'aaa',
    brandId: '75',
  },
  {
    brandName: 'bbb',
    brandId: '12',
  },
  {
    brandName: 'ccc',
    brandId: '16',
  },
];

let b = [
  {
    voteid: 12,
    totolnumber: 110,
  },
  {
    voteid: 16,
    totolnumber: 220,
  },
  {
    voteid: 100,
    totolnumber: 20,
  },
  {
    voteid: 75,
    totolnumber: 20,
  },
];

let c = a.map(item => {
  const d = b.find(({voteid}) => voteid == item.brandId);
  return {
    ...item,
    totolnumber: d ? d.totolnumber : 0,
  };
});

console.log(c);

this kind of simple question, it is recommended to master the basics of js first

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e5bb1d-44ddc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e5bb1d-44ddc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?