I came across the scenario trying with different operating concatenations. I am wondering how this condition was working for the 2nd statement.
console.log("10"+9); // 109
Console.log("10"-9); //1
Can Someone tell me what's happening here?
+
is used for both string concatenation and addition. If either operand is a string, concatenation is used. -
is only used for subtraction, both operants are always coerced to numbers.