This is because
this is a source of much language confusion пут.
Using this ensures that the function works on the exact object in the context of which it was called.
this method, you can not only refer to any property of the object, but also pass a reference to the entire object itself somewhere (reducing the security of the application).
The value of
this is called the calling context and will be determined when the function is called. For example, a function like this, declared without an object, is perfectly valid:
This function does not yet know what this will be. This will be revealed when the program is executed.
If the same function is run in the context of different objects, it will receive a different
So, the value of
this does not depend on how the function was created, it is determined exclusively at the time of the call.
Thanks goes to these wonderful people (emoji key):
🐛 🎨 🖋
🖋 🐛 🎨