Your code has two small errors. See:
var mult = data.qtd++;
The way it is, as you're using post-increment operator, you're basically doing this:
var mult = data.qtd;
data.qtd++;
With this the value of mult
becomes 0
and when doing the multiplication, logically it will return 0
also.
If you do not want to change the value of data.qtd
, look like this:
var mult = data.qtd + 1;
But if you really need to change the value of data.qtd
, you can do so:
var mult = ++data.qtd;
In this way you alteate the value of the variable and then with the updated value you assign it.
And in the last code snippet of the add()
mult * data.vlr_produto
You are multiplying right, but you are doing nothing but multiplying, the result of multiplication being "lost." Since you are not doing anything with it, you are not assigning to a variable, it is not returning, it is not printing.
OBS: In this reply , I explain a bit how the operator of powders and prewash.