I have an array that the data comes from the user's filled form and I make a map:
dados.map(element=> {
var x
var number1 = parseInt(element.preco),
number2 = parseInt(element.peso)
var tota = number1 * number2
console.log(x += tota);
this.prod.push({
produto: element.produto,
peso: element.peso,
preco: element.preco,
total: element.preco * element.peso
})
})
And I wanted to know how to sum the total of all total
of Array
which is preco * peso
, I tried to make x+=tota
, but it is only adding the first two