News for hackers. Stuff that matters.
Re:‘This’ in JavaScript by fenomas on Thursday August 03, 2017 @01:45AM (#14917220)
I agree. The key to grokking this is the difference between a function's execution context and its lexical scope. If you don't explain that I don't think you've explained anything, and if you do then there's no need to think about separate cases like the article suggests.
Re:‘This’ in JavaScript by Joeri on Thursday August 03, 2017 @06:55AM (#14918485)
If you think of javascript code like an english sentence, then the function is the verb, the context (this) is the subject and the scope (arguments, closed over variables) are the nouns.
Re:‘This’ in JavaScript by rippeltippel on Thursday August 03, 2017 @08:09AM (#14918820)
s/nouns/objects/g (then the analogy works for me)