Those who are relatively new to JavaScript might have the impression that JavaScript has no variable types. After all, we declare everything using var and we can treat
1 | if(1 == "1") |
The same as
1 | if(1 == 1) |
or
1 | if("1" == "1") |
But the reality is that JavaScript includes a very rich typing system with some well-known, and some little know methods of detecting types and converting from one type to another.