console.log(true+true); //2 console.log(typeof(true+true)); //number console.log(isNaN(true+true)); //false
Why is adding together 2 boolean types
Javascript is loosely typed, and it automatically converts things into other things to fit the situation. That's why you can do var x without defining it as an int or bool
var x
int
bool
http://msdn.microsoft.com/en-us/library/6974wx4d(v=vs.94).aspx