I'm trying to add some values but instead of a sum result I'm getting the concatenated values, follow the example:
var a = 7.5
var b = 1.00
var c = 2.0
var d = a+b+c
console.log(d) = 7.51.00.2.0
But I wanted to get the following value: 7.5 + 1.00 + 2.0 = 10.5 to later convert into R $ and present as R $ 10.50.
How do I convert this concatenated value to the correct sum value?
I should use parseInt
something like var d = parseInt(a+b+c)
but it did not go the way I expected.
Update Note: In my case some values I'm adding as text () inside the tag, in some cases I'm getting the value of the tag and adding the value inside it via text () is there any other way that keeps the number as number and not string?