In javascript, a (admittedly sloppy) way of checking whether a variable is set is to check whether it's "truthy", by
var blah;
blah = "foo"; // in real code, this assignment might happen only sometimes
if(blah) {
console.log('blah is set');
}
I had thought "loose" equality operator was equivalent to a truthy test. Howcome, then, the expression "foo" == true
evaluates to false
?