JavaScript Execution Context Fundamentals

🚀Day 3/100 #100DaysOfCode — JavaScript Core Foundations Today, I revised the fundamentals that actually control how JavaScript behaves under the hood. 🔹 Execution Context JavaScript runs in two phases inside the Global Execution Context: 1️⃣ Creation Phase Memory allocated var → initialized as undefined let & const → hoisted but placed in the Temporal Dead Zone (TDZ) 2️⃣ Execution Phase Code executes line by line Variables receive real values 🔹 var vs let vs const var is hoisted with undefined let & const are hoisted but inaccessible before declaration (TDZ) var allows re-declaration let & const do not var & let allow reassignment const does not var is function-scoped let & const are block-scoped 🔹 Arrow Functions Not hoisted like traditional functions No own this (inherits lexically) Cleaner implicit return const sum = (a, b) => a + b; 🔹 Rest & Spread Rest → collects remaining parameters into an array Spread → expands array elements 🔹 Destructuring Cleaner extraction from arrays & objects: let { name: myName, address: { city } } = person; Understanding execution context + scope is the foundation for closures, async JS, and advanced patterns. No shortcuts. Just depth. Day 4 tomorrow. #JavaScript #WebDev #IntermediateJS #CodingChallenge #Frontend #SoftwareEngineering #MERNStack #LearningEveryday

To view or add a comment, sign in

Explore content categories