0
why '+' act like a parse and what is the difference ???
+"10.1" + +"32.3" vs parseFloat("10.1") + parseFloat("32.3") both statement will produce the same result 42.4 using this statement: +"10.1" + +"32.3" why '+' act like a parse and what is the difference ???
3 Réponses
+ 3
"+" is used for concatenation, i.e bringing two or more strings or vars together..
While
"parse" is used to convert something to a particular datatype...
E.g parseFloat("10.1")
You've just converted 10.1 to a float datatype..
+ 1
I think you getting it mixed up, let's have your code example
0
ill tried using this statement:
+"10.1" + +"32.3"
result would be 42.4
why '+' act like a parse and what is the difference???