en.javascript.info/1-js/4-object-basics/03-object-methods/4-object-property-this/task.md
Ilya Kantor 4c531b5ae7 ok
2016-07-31 00:28:27 +03:00

23 lines
307 B
Markdown

importance: 5
---
# Using "this" in object literal
Here the function `makeUser` returns an object.
What is the result of accessing its `ref`? Why?
```js
function makeUser() {
return {
name: "John",
ref: this
};
};
let user = makeUser();
alert( user.ref.name ); // What's the result?
```