SKsujay kumarinsujaynitrr.hashnode.dev·Mar 20, 2025 · 4 min readUnderstanding the JavaScript Engine, Browser power, Call Stack, and Asynchronous OperationsThe Browser and Its JavaScript Engine The browser has a built-in JavaScript engine responsible for executing JavaScript code. The Call Stack always resides inside this engine and handles synchronous code execution. However, the browser is much more p...00
SKsujay kumarinsujaynitrr.hashnode.dev·Mar 4, 2025 · 4 min readInterview question based on setTimeout and ClosuresExample: function x() { for (var i = 0; i < 6; i++) { setTimeout(function () { console.log(i); }, 3000); } console.log("Hello JavaScript"); } x(); The function inside setTimeout forms a closure over i. Since var i is function-s...00
SKsujay kumarinsujaynitrr.hashnode.dev·Feb 28, 2025 · 2 min readJavaScript Functions: Declarations, Expressions, and First-Class CitizensFunction Statement/Declaration Function statement and function declaration both are the same: function a() { console.log("hello a"); } Function Expression A function expression is when a function is assigned to a variable: var b = function() { ...00
SKsujay kumarinsujaynitrr.hashnode.dev·Feb 24, 2025 · 5 min readScope, Scope chain ,Lexical and ClosuresScope: Scope refers to the context or environment in which a variable is declared and can be accessed. A variable’s scope defines where it can be used and where it is accessible. There are two type of scope : Local scope and 2. Global scope For exa...00
SKsujay kumarinsujaynitrr.hashnode.dev·Feb 22, 2025 · 2 min readundefined vs not defined in JavaScript:undefined: In JavaScript, undefined is a primitive value and a type. It is the default value assigned to variables that are declared but not yet assigned any value. The JavaScript engine automatically assigns undefined when memory is allocated to a...00