DEV Community

Discussion on: Today I answered a question which has been bothering me for a long time.

zunamidev profile image
zunami Author

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.