Clarity for this

A more ideal explanation of `this` assigning
This commit is contained in:
Anton A. Zabirko 2017-11-10 07:59:54 -08:00 committed by GitHub
parent b2559f4d39
commit cb26b559bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -154,8 +154,8 @@ let user = { name: "John" };
let admin = { name: "Admin" };
// use call to pass different objects as "this"
sayHi.call( user ); // John
sayHi.call( admin ); // Admin
sayHi.call( user ); // this = John
sayHi.call( admin ); // this = Admin
```
And here we use `call` to call `say` with the given context and phrase: