let arr = [{
a:'W',b:'W01'},{
a:'W',b:'W02'},{
a:'WC',b:'WC01'},{
a:'WC',b:'WC02'},{
a:'WC',b:'WC02'},{
a:'WC',b:'WC02'}]
let map= {
};
arr.forEach(item=>{
if(map[item.a]){
map[item.a].push(item.b);
}else{
map[item.a] = [item.b];
}
})
console.log(map);
出力効果は図のようになります