@bz_moz can you explain how that is a pitfall? If window.foo is truthy the expression returns. Assuming it’s the right thing is a pitfall
-
-
-
@rwaldron If that statement is at global scope, the var shadows the property (which lives on Window.prototype), so window.foo is undefined. - 16 more replies
New conversation -
-
-
@bz_moz Huh? Wouldn't an unprefixed pass the first || and get returned? -
@tabatkins It depends on where you put the code. At global scope the var shadows the property on the proto, so window.foo tests false.
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.