Abhishek Dandriyalabhishek-dandriyal.hashnode.dev·Apr 8, 2024Javascript Scope: Var, Let and ConstVariable shadowing: In JavaScript, variable shadowing occurs when a variable with the same name as a variable in a higher scope is declared in a lower scope, potentially causing confusion; let a = 10; if (true) { let a = 20; console.log(a); } ...Discuss·1 likeIllegal shadowing
Gaurav Goswamigauravgoswami.hashnode.dev·Mar 31, 2024How JavaScript works??? 🤔💭When I started my journey with JavaScript I used to think about how things work under the hood, why the setTimeout code runs after the synchronous code, how is it even possible to call a function even before declaring it, and why do we get errors if ...Discuss·1 like·102 readsjsworking
Amit Gossaiamitbhu.hashnode.dev·Jan 7, 2024what do you mean by Hoisting and Temporal Dead Zone in JS ?Hoisting is a concept that enables us to extract values of variables and functions even before initializing/assigning value without getting errors and this happens during the 1st phase (memory creation phase) of the Execution Context. In the context ...DiscussJavaScript
Corina Murgcorina.hashnode.dev·Oct 2, 2023The Temporal Dead ZoneThe Temporal Dead Zone sounds like a sci-fi movie, doesn't it? But in the JavaScript universe, it's the space where a variable is off-limits, even though you might think it should be available. This behavior occurs with variables declared using let a...Discuss·1 likeHoisting in JavaScriptJavaScript
Ekaterine (Catherine)ekaterine-mitagvaria.hashnode.dev·Sep 28, 2023What is the Temporal Dead Zone in JavaScript?The temporal dead zone is one of the most essential things to understand when you first start learning JavaScript as it will make it much easier to continue your JavaScript journey. In this article, we are going to understand what a temporal dead zon...Discuss·30 readsJavaScript
Corina Murgcorina.hashnode.dev·Aug 26, 2023The Curious Case of JavaScript HoistingEver played with a yo-yo? In JavaScript, variables and traditional function declarations act much like one: they start at the bottom but magically make their way to the top! Welcome to the fascinating realm of hoisting, a unique JavaScript mechanism ...DiscussHoisting in JavaScriptHoisting
Lim Woojaejaylog.hashnode.dev·May 19, 2023[JavaScript] Understanding Hoisting - Common Interview QuestionIntroduction Let's have a look at this code: console.log(a); // Reference Error and TDZ let a = 10; Reference error occurs because variable a is referenced before the declaration. Then, you might ask to put the declaration above the console.log() li...Discuss·109 readsJavaScriptJavaScript
Lim Woojaejaylog.hashnode.dev·May 18, 2023[JavaScript] Deep Dive into Temporal Dead Zone (TDZ)Introduction Can you predict the output of these snippets of JavaScript code? Would the error occur? const hyundai = new Car(); class Car { constructor(color) { this.color = color; } } // Error or not? myFunc(); function myFunc() { conso...Discuss·94 readsJavaScriptJavaScript
Sobit Prasadsobitprasad.hashnode.dev·Mar 1, 2023Understanding Var, Let and Const in JavaScript with ExamplesOverview Unlike other programming languages, like Java and C++ where we need to specify the type of variables while declaring, it is somewhat different in JavaScript. JavaScript limits us to declare variables only using these three keywords - the var...Pranita Fulsundar and 4 others are discussing this5 people are discussing thisDiscuss·19 likes·419 readsJavaScript
Akash Kumar Singhdarkshadow.hashnode.dev·Feb 15, 2023What is Temporal Dead Zone?A temporal dead zone (TDZ) is the area of a block where a variable is inaccessible until the moment the computer completely initializes it with a value. But wait we are not directly going to jump into the depth of the temporal dead zone. So It all st...Discuss·3 likes·136 readsJavaScript