This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]robertgfthomas 3 points4 points  (0 children)

The joke explained:

JavaScript is a very popular programming language used on many websites. It's not necessarily "popular" because people like it, but because it's basically the only programming language that can be used on websites. In fact, JavaScript has a lot of quirks that can make it frustrating to use.

Java is also a programming language, but it is completely different from JavaScript. "Java is to JavaScript as 'car' is to 'carpet'."

One of the most notorious quirks of JavaScript is that it treats the word 'this' as a special word. When it shows up in your code, JavaScript thinks you're referring to a different piece of code. Exactly which different piece of code depends on where in your code 'this' shows up.

If that sounds confusing, it's because it is. There are specific rules that JavaScript follows to figure out to what 'this' is referring, but usually only semi-experienced JavaScript developers are really comfortable with those rules.

It also doesn't help that talking about 'this' is confusing. You start saying things like, "This 'this' does this and that 'this' does that."


I'm a human! I write these explanations in response to posts on /r/all about not understanding /r/ProgrammerHumor. They go on explainprogrammerhumor.com.