Tagged articles
hoisting
10 articles · Page 1 of 1
This article explains why a JavaScript function using var prints “2” twice, by detailing var’s function scope, variable hoisting, the compilation and execution phases, and contrasting the behavior with let and const, while offering practical coding recommendations to avoid common pitfalls.
JavaScriptconsthoisting
0 likes · 9 min read

This article examines why the traditional JavaScript var keyword should be avoided, explains the subtle pitfalls of its function scope, hoisting, and global leakage, and highlights the essential, often overlooked features of let and const—including temporal dead zone, true block scope, and immutability nuances.
JavaScriptconsthoisting
0 likes · 8 min read

This article explains JavaScript's pre‑compilation process, including variable and function declaration hoisting, the creation of execution contexts, and the differences between var, let, and const, using several illustrative code examples to clarify how the engine resolves identifiers at runtime.
JavaScriptPre-compilationfunctions
0 likes · 7 min read

This article explains the differences between JavaScript's var, let, and const declarations, covering their scopes, hoisting behavior, and mutability, and provides clear code examples for each. It also highlights how const variables can still be modified when they hold objects or arrays, helping developers choose the right keyword for reliable code.
JavaScriptconsthoisting
0 likes · 5 min read

This article explains JavaScript's variable scope models—including lexical and dynamic scope—covers the three scope types (global, function, and block), details hoisting, the eval function, scope chains, and closures, and shows practical code examples for each concept.
Evalclosurehoisting
0 likes · 18 min read

This article explains how JavaScript engines hoist function and variable declarations, compares the behavior of var, let, and const during creation, initialization, and assignment, and demonstrates the resulting runtime errors and output through clear code examples.
ES6FunctionJavaScript
0 likes · 7 min read

This article explains how JavaScript execution contexts and the call stack work, covering their types, creation and execution phases, this binding, lexical and variable environments, and includes code examples to illustrate these core concepts for developers.
Execution ContextLexical Environmentcall stack
0 likes · 13 min read

This article chronicles the author’s two‑month journey of understanding JavaScript’s let declaration, exploring its block scope, temporal dead zone, per‑iteration bindings, and the nuanced differences from var and function hoisting, while debunking common misconceptions with code examples and spec references.
ES6Variable Scopefrontend
0 likes · 10 min read


21CTONov 15, 2015 · Frontend Development
This article explains the crucial differences between JavaScript function declarations and function expressions, how hoisting affects their availability, and why misunderstanding these concepts can lead to unexpected bugs in your code.
JavaScriptfrontendfunction-declaration
0 likes · 7 min read

JavaScript executes code by first compiling function and var declarations within a scope, then running statements top‑to‑bottom, which explains why accessing a var‑declared variable before its assignment yields undefined while referencing an undeclared variable throws an error, as illustrated through detailed examples.
FunctionJavaScriptexecution
0 likes · 4 min read
