# 6.5 this 키워드

* 객체의 프로퍼티인 함수에서 의미가 있음
* 메서드를 호출하면 this는 호출한 메서드를 소유하는 객체가 됨
* **중첩된 함수 안에서 this를 사용하면 의도한대로 동작하지 않음 --> this를 다른 변수에 할당**
* **그러므로 this를 self나 that에 할당하는 코드가 많음**

```javascript
const o2 = {
    name: 'Wallance',
    bark: function() { return "Woof! my name is " + this.name }
}

console.log(o2.bark()); // Woof! my name is Wallance
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://april.gitbook.io/learning-js/chapter-6./6.5-this.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
