I have two javascript array
let a=[{id:1},{id:2},{id:3}];
let b=[{count:35, name:'test', age:12}, {count:45 name:'test2', age:9}];
and two array push into i need final Array format is
[{count:35,name:'test', age,12, id:1} , {count:35, name:'test', age:12,id:2},{count:35, name:'test', age:12,id:3},{count:45,name:'test', age,9, id:1} , {count:45, name:'test', age:9,id:2},{count:45, name:'test', age:9,id:3} ]
And i trying
for ( var index=0; index<b.length; index++ ) {
for ( var j=0; j<a.length; j++ ) {
for (const [key, value] of Object.entries(a[j])) {
//if(j==index)
b[index][key]=value;
k[j]=b[index];
}
console.log( b[index]);
c.push(b[index]);
}
}
console.log(c);
please any body help to fix the problem
