3 ms·
Right, it doesn't work when you're testing whether foo is a bound name at all. In that case you need to use "window.foo" (or this.foo in Node). And yeah, it's
by ootachi 15y ago
Right, it doesn't work when you're testing whether foo is a bound name at all. In that case you need to use "window.foo" (or this.foo in Node).
And yeah, it's double equals. The coercion is exactly what allows "== null" to do the right thing in the presence of undefined. Contrary to popular belief, "0 == null", "'' == null", and "[] == null" are all false in JavaScript. "foo == null" doesn't test for falsiness, it just checks whether foo is null or undefined.