Hacker News new | ask | show | jobs
by shabble 4913 days ago
because you sometimes want to refer to the original 'this' reference inside an inner nested function scope, where the actual 'this' keyword is rebound to the context of the inner function.

    function outer() {
        var outer_this = this;
        var inner = function() {
            var inner_this = this;
            // ...
        }
    }
http://stackoverflow.com/questions/4886632/what-does-var-tha... has some more details.
1 comments

Of course there are exceptions to the rule, but the rule should still be - avoid 'this.'