Skip to content
Advertisement

.js + sql variables cant get the sum

It just gives the two variables put together instead of the sum of the two

Ex. 1 + 2 = 12 instead of 1 + 2 = 3 or args[1] + money = args[1]money instead of new value

Advertisement

Answer

I can’t see where you are doing this operation and assigning it to a variable, maybe you mean this line parseInt(args[1].value, 10) + money;? this line is not assigned to a variable, but anyway the issue you are face seems to be related to string concatenation instead of sum numbers just add a + sign just right before your variables like this

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement