A particularly interesting case is the sum of numbers that can be in the form of text strings. In a simple arithmetic statement, which adds two numbers, you get the expected result:
var soma = 3+3;
3+"3" the strength of the string in the second value prevails over the entire operation. The first value is automatically converted to string, and the result associates the two strings.
var soma = 3+"3";
See what happens when another number is added to the statement:
3 + 3 + "3"
var soma = 3 + 3 + "3";
Note that in these cases the
+ operator before strings did not convert the string to integer!
The correct function to use is
var soma = 3 + 3 + parseInt("3");