"If you are new to JavaScript, I suggest avoiding the this keyword until you get comfortable with the basics of the language." This is terrible advice. If all beginners started learning Javascript by getting a firm grasp of this, there would be a lot fewer mistakes and misunderstandings down the road.
Not to mention the this keyword JavaScript has a completely different use than most other languages. The author plainly just does not understand JavaScript.
I assure you the author understands JavaScript just fine. :)
The this keyword absolutely does have different uses from other programming languages, and that's precisely why I recommend focusing on the basics of JS first. So many people get tripped up out of the gate when it comes to JS, because they go into it expecting it to behave like other languages they've used in the past.
It is absolutely essential for a professional JS developer to understand the this keyword. However, for the newbie jumping into the language for the first time from a PHP background, I would rather they grok the module pattern, JavaScript closures, etc. before they get into the complex stuff. Odds are they're starting out by mucking around with some simple event handlers anyway.
20
u/youngsteveo Feb 23 '13
"If you are new to JavaScript, I suggest avoiding the this keyword until you get comfortable with the basics of the language." This is terrible advice. If all beginners started learning Javascript by getting a firm grasp of
this, there would be a lot fewer mistakes and misunderstandings down the road.