This commit is contained in:
Ilya Kantor 2019-07-29 00:12:34 +03:00
parent 3ba28aa104
commit 34e9cdca36
10 changed files with 55 additions and 62 deletions

View file

@ -111,6 +111,7 @@ let user = {
sayHi() {
*!*
// "this" is the "current object"
alert(this.name);
*/!*
}
@ -176,7 +177,7 @@ function sayHi() {
}
```
The value of `this` is evaluated during the run-time, depending on the context. And it can be anything.
The value of `this` is evaluated during the run-time, depending on the context.
For instance, here the same function is assigned to two different objects and has different "this" in the calls: