0
I have the array this.produtoAlvoAlterar.variacao.preco_variacao
I need to replace the variable tag of this array with the value contained in the array this.anuncioAlterar.variations.specifications.preco
I tried to make a repeat structure to pass these values from one array to another, it was like this:
for(let i=0;i<this.produtoAlvoAlterar.variacao.length;i++){
for(let j=0;j<this.anuncioAlterar.variations.length;j++){
for(let k=0;k<this.anuncioAlterar.variations[j].specifications.length;k++){
if(this.anuncioAlterar.variations[j].specifications[k].key == "Preço"){
this.produtoAlvoAlterar.variacao[i].preco_variacao = this.anuncioAlterar.variations[j].specifications[k].value;
}
}
}
}
At the first position of the array the value of this.produtoAlvoAlterar.variacao.preco_variacao
should be set to the value "222.22" and in the second position to "333.33" but both positions are having the value "333.33", which is the value of the second key of the array this.anuncioAlterar.variations.specifications
@Edit:
You can edit your question and put the arrays? so it is easier to help...
– OtavioCapel
This data structure of yours is confused. Having 3 Fors inside each other is nothing scalable.
– Eduardo Vargas
I edited the post with the information of the arrays
– veroneseComS