From 05ebb7fe45c2582adcf35dfde34ac8300f742831 Mon Sep 17 00:00:00 2001 From: Abhas Bhattacharya Date: Fri, 3 Apr 2020 09:41:32 +0530 Subject: [PATCH] update post: What is `this` inside foo.bar()? --- ck8dzlitm01atxjs1322jz9a2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ck8dzlitm01atxjs1322jz9a2.md b/ck8dzlitm01atxjs1322jz9a2.md index b6d58bb..21bd866 100644 --- a/ck8dzlitm01atxjs1322jz9a2.md +++ b/ck8dzlitm01atxjs1322jz9a2.md @@ -46,7 +46,7 @@ Effectively - One example of this is rewriting `foo.bar()` using a intermediate variable - ` fn = foo.​bar; fn()`. -If `bar` was referencing other values from foo using `this`, those values will become undefined or resolve to a wrong variable. +Now. if `bar` was referencing other values from foo using `this`, those values will become undefined or resolve to a wrong variable. 🧠 This is exactly the reason why passing methods as callback changes the value of `this` (passed within it). Instead of calling a method directly, callback is passed as a function and called later by some other code.