Home » Posts tagged "type conversion"

JavaScript Alchemy with Strings, Numbers, and Booleans.

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

if(1 == "1")

The same as

if(1 == 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.


Continue reading “JavaScript Alchemy with Strings, Numbers, and Booleans.”