DEV Community

Discussion on: What is "This"? a JavaScript Explanation

Collapse
 
pentacular profile image
pentacular

What I like about starting with the foo.call(x) example is that it immediately drains all of the magic.

There are no methods in javascript, functions do not belong to classes.

There are just functions which are invoked with some object as their 'this' context.

Having understood this, you can then move on to a.b(c) and show that it's equivalent to a.b.call(a, c).

Thread Thread
 
hdezmax profile image
Maximiliano Hernández Betancourt

I had not thought of it that way, I appreciate your reflection on the subject and I will consider it for future articles.

Thank you! :D

Thread Thread
 
pentacular profile image
pentacular

You are welcome. :)