This (and why it’s so weird in JavaScript)
A lot of people come to JavaScript from languages like Java. And, at first glance, the languages seem kind of similar - they even have similar names! Of course, it soon becomes apparent that there are some pretty important differences. For example, Java is object-oriented, statically typed and lexically scoped. JavaScript isn't these things (except sometimes, when it is). And one of the places that these differences are really obvious is in the use of the keywordthis
.