1
var armazenamento = [];
armazenamento.push({nome: nomeproduto, valor: + preco})
for(i in armazenamento){
total =+ armazenamento[valor: i]
i++
}
console.log(total)
troco = PagoCliente - total
I created an array called storage and added name and value to it, then I’m trying to store all the values in a variable called total to then display how much change to give to the client. Only when I ask for change he’s showing up Nan
Romulo, is your example running? For this line
total =+ armazenamento[]
nor does it allow me to execute the code.– Daniel Mendes
ended that I did not put here, but it was to come out like this: total =+ storage[{value: i}]
– Romulo Lessa