This with regular functions and arrow functions in javascript example

preview_player
Показать описание
Arrow functions do not create their own this.

Instead, they take this from the surrounding scope.
In the case of an arrow function, this is not bound to the object that called the function (in this case, the person2 object), as it is in normal functions.
Arrow function does not create its own this. Instead, this is taken from the context in which the function was defined (ie, the scope from which it is called).
The context of this:

In the case of our arrow function, greet is an arrow function defined inside the person2 object. But the arrow function takes this from the outer context, which, in the case of top-level code (that is, not in a method or another object), will be this global (in the browser, it will refer to the window).
Рекомендации по теме
join shbcf.ru