From bbc8e40d15b19abda92d807ad1ddde9bb7e6a061 Mon Sep 17 00:00:00 2001 From: Ish Date: Sun, 4 Aug 2024 21:38:13 +0530 Subject: [PATCH] added a minor catch for Question 3 After reading the current explanation, people will assume that declaring a variable in the outer scope would fix the issue, but using `let` for doing the same would still result in the same issue as let variables are not part of the global context. --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index b203a060..6728955a 100644 --- a/README.md +++ b/README.md @@ -144,6 +144,8 @@ With arrow functions, the `this` keyword refers to its current surrounding scope Since there is no value `radius` in the scope of the arrow function, `this.radius` returns `undefined` which, when multiplied by `2 * Math.PI`, results in `NaN`. +##### Catch: Declaring a variable radius in the global context using the `var` keyword would fix this issue, but declaring the same variable using `let` would still give an issue. [reason](https://stackoverflow.com/questions/60346763/why-global-let-variables-not-added-to-window-object-of-browser#:~:text=This%20is%20by%20design%3A,function%20regardless%20of%20block%20scope.) +