TGViewer
As For JS As For JS @asforjavascript · 3.07K subscribers
Post #418 3.92K
07-00 По Київу
Вирішуємо завдання із співбесід: this так, this сяк, this наперекосяк
Обговоримо питання з нашого Телеграм чату, щодо this.
https://www.youtube.com/watch?v=nwrN8FY_cVo


https://t.me/AsForJsTalks/83930
function foo() {
const x = 10;
return {
x: 20,
bar: () => {
console.log( 'bar:', this.x );
},
baz: function () {
console.log( 'baz:', this.x );
}
};
}

const obj1 = foo();
obj1.bar(); // ?
obj1.baz(); // ?

const obj2 = foo.call( { x: 30 } );
let y = obj2.bar;
let z = obj2.baz;
y(); // ?
z(); // ?
obj2.bar(); // ?
obj2.baz(); // ?

Текст до відео
https://docs.google.com/document/d/1wd2VWCyxf1ITy65-i85Dgcjl8LhDtEiKbWoyC-Ac-Bk/preview
YouTube Вирішуємо завдання із співбесід: this так, this сяк, this наперекосяк Обговоримо питання з нашого Телеграм чату, щодо this. https://t.me/AsForJsTalks/83930 function foo() { const x = 10; return { x: 20, bar: () =⧽ { console.log( 'bar:', this.x ); }, baz: function () { console.log( 'baz:', this.x ); } }; }…
  • 👍 25
  • ❤ 16
  • 👀 3
  • 👎 1
  • 🔥 1
  • 😍 1
More from @asforjavascript
  1. Oct 15, 2026Люди любят тех, кто помогает им, любить себя.
  2. Oct 14, 2026Кому нечем заняться и хочется подумать. Как, согласно современному HTML5 должна быть разоб…
  3. Oct 14, 2026https://music.youtube.com/watch?v=y7TOV4AvKJs&si=QbHucJbQ2swJi-0G
  4. Oct 13, 2026Тимур Шемсединов раскопал в записях еще один эфир второго в мире JS радио. Было это недели…
  5. Oct 11, 2026Гениальный Кирилл Львович Масленников о темной материи полтора часа кайфа https://youtu.be…
  6. Oct 10, 2026Два дня назад, в возрасте 90 лет умерла Маргарет Гамильтон. В один из критических моментов…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →