This is something like an infinite loop for me.
var sM = "Hello" - "World";
console.log(sM) && console.log(typeof sM);
I understand why string - string outputs NaN, but then "Hello" - "World"
typeof
is a number
.
It means subtracting string with another string gives you a type of a number
.
Where is the logic in that?
why string - string outputs NaN
Because subtraction only deals in numbers, so it converts both sides to numbers and gets Not A Number.
but then "Hello" - "World" typeof is a number.
NaN
has the type Number. This is standard in computing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With