News for hackers. Stuff that matters.
Re:JavaScript: what is "this"? by papercrane on Monday March 22, 2010 @10:00AM (#1210302)
Since the comparison happens before var is declared, it will always evaluate to 'true'. I believe the author was thinking about something like so:

    (function(name) { var cmp = function() { return name=="tim"; }; var name; return cmp();})("tim");
This still evaluates to true, but I believe it has to do with the rules of shadowing. If you change the declaration to 'var name="bob";' it will return false.

There are no comments on this comment yet.