Hacker News new | ask | show | jobs
by nicholas73 4567 days ago
The answer the interviewer was looking for seems to expect knowledge of how 'this' is different in Javascript versus other languages, and how things can go wrong. That is different from simply knowing that 'this' refers to an object.

Since this is for a junior position, conceivably an applicant could be a recent CS grad with no formal JS training, and hacked some projects on a side or job. And thus never by happenstance run into this issue, even if he read it somewhere sometime.

2 comments

As someone that is self-taught via books, websites and finding stuff out on Stackoverflow, etc. I feel like everyone should know this. I hear all languages have their quirks, but this is emphasized so much in JS that if you don't have at least a passing familiarity with it I'd wonder how learned the language. However, most people are way smarter than me and maybe they're learning through reading code and just building. In this case, sure, maybe they've never run into the issue.
To be clearer, I wasn't just referring to the fact that 'this' refers to an object, but the complexity inherent in the term in JS.

You can run into this problem by doing something as basic as using it in a click handler if you don't know that it's there.