If we calculate ("11" - 0) we get a number again and then if we add 1 we have not anymore the string case. On the other example with ("11" + 1) here we have the case with string join and then it joins if we subtract it by 0 it will be the same but if we subtract it with a different number it will be converted into a number. But yes you are right its important to check the order of operations. The explanation is just for those who don't understand it.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
And
"11" - 0 + 1
yields12
while"11" + 1 - 0
yields111
... order of operations can be important!If we calculate ("11" - 0) we get a number again and then if we add 1 we have not anymore the string case. On the other example with ("11" + 1) here we have the case with string join and then it joins if we subtract it by 0 it will be the same but if we subtract it with a different number it will be converted into a number. But yes you are right its important to check the order of operations. The explanation is just for those who don't understand it.