Can you help me create a JavaScript array and save another array of data to be part of the newly created array in JavaScript? I attempted it using the code below.
Code:
var vvv=this.new_products.length-this.quote.lines.length;
let mmm={};
if(vvv > 0){
for(var i = 0; i <= vvv-1; i++){
mmm ={...this.new_products[this.quote.lines.length+i]};
}
}
console.log(mmm);
Example:
this.new_products ->
0: {…}
1: {…}
2: {…}
3: {…}
this.quote.lines ->
0: {…}
1: {…}
The desired output should be ->
mmm->
0: {…} (this.new_products[2])
1: {…} (this.new_products[3])
Current output->
{product_code: "khdbdvdjlhc de", description: "sscs", note: "csccc", pinned: false, third_party: 0, …}
Unfortunately, my current code is not working as expected. Any assistance on how to resolve this issue would be highly appreciated.