if I do a addition with a string and a int it the string joins with the string,
"11" + 1 = "111"
and if I do a subtraction the string becomes subtracted like int minus int.
"11" - 1 = 10
That was the question which bothered me a long time. Today I found the answer in the ECMAScript semantics.
On page 294 is the semantic for the addition operator (+) which is not only used to add two numbers or more, no its also used to join strings and if one of the given values is a string it converts both values (if the string contains a number not something like "eleven" it must be "11") to a string and return it as a joined string.
And the Subtraction Operator (-) converts both values to a number (if possible) and then it subtracts them.
And it makes the language now a bit more logical for me I hope for you too. I'm sorry for my English btw I'm learning it currently.
Its my first blog post if you have feedback please leave a comment.