English
Open in Telegram

Post When "inner()" looks for:

12 October 2026
W
Web Development - HTML, CSS & JavaScript
When "inner()" looks for: name it finds it in its own scope. For: city JavaScript looks in the outer scope. For: country it goes one level further outward. Conceptually: inner scope ↓ outer scope ↓ global/module scope This is the scope chain. 8️⃣ What Is Hoisting? Hoisting describes how JavaScript's execution process makes certain declarations available before their position in the source code is reached. But different declarations behave differently. This is why you should avoid thinking of hoisting as simply: "JavaScript moves all code to the top." That's not an accurate mental model. 9️⃣ Function Declaration Hoisting Function declarations can be called before their declaration in the same scope. greet(); function greet() { console.log("Hello"); } Output: Hello The function declaration is available when execution begins. 🔟 "var" Hoisting Consider: console.log(age); var age = 25; The result is: undefined Conceptually, you can think of the declaration being initialized early: var age; console.log(age); age = 25; The important point is: var declaration → initialized as undefined before normal execution reaches the assignment. 1️⃣1️⃣ "let" and "const" Hoisting Now consider: console.log(age); let age = 25; This produces a ReferenceError. The same applies to: console.log(age); const age = 25; Why? "let" and "const" declarations are created during the setup phase, but they aren't initialized until execution reaches their declaration. The period between entering the scope and initialization is called the: Temporal Dead Zone (TDZ) 1️⃣2️⃣ Temporal Dead Zone Example: { console.log(name); let name = "Rahul"; } The variable "name" exists in the scope, but accessing it before initialization causes an error. Conceptually: Block begins ↓ name exists but is uninitialized ↓ Temporal Dead Zone ↓ let name = "Rahul" ↓ name becomes initialized So: console.log(name); let name = "Rahul"; is not equivalent to using "var". 1️⃣3️⃣ Why "let" and "const" Are Safer Compare: console.log(value); var value = 10; Output: undefined versus: console.log(value); let value = 10; Error: ReferenceError The error makes the problem much easier to detect instead of silently giving you undefined. 1️⃣4️⃣ Function Scope vs Block Scope Example Consider: function test() { if (true) { let a = 10; var b = 20; } console.log(b); } test(); This works because "b" is function-scoped. But: function test() { if (true) { let a = 10; } console.log(a); }
6 · 920 ·

Nearby in the feed

WWeb Development - HTML, CSS & JavaScript🚀 𝗪𝗵𝗶𝗰𝗵 𝗧𝗲𝗰𝗵 𝗦𝗸𝗶𝗹𝗹 𝗪𝗶𝗹𝗹 𝗬𝗼𝘂 𝗠𝗮𝘀𝘁𝗲𝗿 𝗶𝗻 𝟮𝟬𝟮𝟲? Want to build apps, uncover insights, or create AI solutions? Explore certification courses that match your career gWWeb Development - HTML, CSS & JavaScript💻 JavaScript Roadmap 2026 — Part 9 🟡 Scope, Hoisting & Execution Context Now we're moving from basic JavaScript syntax into concepts that explain how JavaScript
this message
WWeb Development - HTML, CSS & JavaScriptdoesn't work because "a" is block-scoped. ⭐ 1️⃣5️⃣ What Is an Execution Context? When JavaScript runs code, it creates an execution context. An execution contexWWeb Development - HTML, CSS & JavaScript𝗧𝗢𝗣 𝗙𝗥𝗘𝗘 𝗖𝗢𝗨𝗥𝗦𝗘𝗦 𝗧𝗢 𝗕𝗢𝗢𝗦𝗧 𝗬𝗢𝗨𝗥 𝗦𝗞𝗜𝗟𝗟𝗦 𝗜𝗡 𝟮𝟬𝟮𝟲! Explore FREE online learning resources to develop in-demand skills and improve your career opportunities! 🎓 Why E
WWeb Development - HTML, CSS & JavaScriptWeb Development - HTML, CSS & JavaScript@javascript_courses · channel · Tech
55 690subscribers1 964average post reach
Venue feed Open in Telegram

An open public feed from the search index ChatCrawler — “Google for public Telegram”; refreshed as the venue is crawled. Times are UTC.

Public content only, official Telegram API. About · FAQ · Index limits · Remove a page · Catalog · Search · How we count