From e8f119c29ed970480e92f426fb209468b7535996 Mon Sep 17 00:00:00 2001
From: ishwar rimal
Date: Thu, 28 Nov 2024 22:01:56 +0530
Subject: [PATCH] Question 156: let not part of global object
---
README.md | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/README.md b/README.md
index b203a060..b691618b 100644
--- a/README.md
+++ b/README.md
@@ -5149,3 +5149,34 @@ The condition within the `if` statement checks whether the value of `!typeof ran
+
+---
+
+###### 156. What's the output?
+
+```javascript
+var x = "global!";
+let y = "global!";
+function helper(){
+ x = "local!";
+ y = "local!";
+ console.log('X is ',this.x);
+ console.log('Y is ',this.y);
+}
+helper()
+```
+
+- A: `X is global! | Y is global!`
+- B: `X is global! | Y is local!`
+- C: `X is local! | Y is local!`
+- D: `X is local! | Y is undefined`
+
+Answer
+
+
+#### Answer: D
+
+At the top level of programs and functions, `let`, unlike `var`, does not create a property on the global object.
+
+
+
\ No newline at end of file