DEV Community

Discussion on: Call, Apply, Bind - The Basic Usages

Collapse
 
sergiokag profile image
Sergio Kagiema- Fay

Nice work Alex.

A small correction upon the 'this' keyword.

A 'this' variable is created when a new execution context is created. And its value it might be anything.

Collapse
 
alexantoniades profile image
Alexander Antoniades • Edited

Thank you Sergio!
Yes of course..! I don't mention how or when "this" is created. Just stating the fact that every object has a "this" assigned to it!
The value of "this" might be anything within the context that is created. Of course you can change that with the methods mentioned in this article ;)

Collapse
 
sergiokag profile image
Sergio Kagiema- Fay

Sorry, I did not make it clear.

Every object doesn't have a 'this' assigned to it.

The 'this' is related to the execution context. And the execution context means how a function is called.
That's why I mentioned that a 'this' variable is created when a new execution context is created. :)

Thread Thread
 
alexantoniades profile image
Alexander Antoniades

As I've already mentioned in the article....I don't go into much details about "this" and
the execution context. The purpose of this article is for a beginner to have a basic understanding of how call, apply and bind works. Saying that every object or function has it's own "this" keyword/variable/object (say it however you want) is enough to make someone understand the basics. Maybe I'll write an advanced article on these concepts next time.

thanks again for the feedback Sergio.