> For the complete documentation index, see [llms.txt](https://artfulbits-se.gitbook.io/typescript/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://artfulbits-se.gitbook.io/typescript/recap/this.md).

# this

Будь-який доступ до ключового слова `this` у функції контролюється способом виклику функції. Його зазвичай називають "контекстом виклику".

Приклад:

```ts
function foo() {
  console.log(this);
}

foo(); // logs out the global e.g. `window` in browsers
let bar = {
  foo
}
bar.foo(); // Logs out `bar` as `foo` was called on `bar`
```

Тому будьте обережні з використанням `this`. Якщо ви хочете від'єднати `this` у класі від контексту виклику, використовуйте функцію-стрілку, [докладніше про це пізніше](/typescript/future-javascript/arrow-functions.md).
