Every JavaScript object contains a private property pointing to another object called its .
For let and const , they are hoisted but not initialized, leading to a "Temporal Dead Zone" (TDZ) where accessing them before declaration results in a ReferenceError .
Delays the execution of a function until a specific amount of time has passed since the last time it was invoked. (Perfect for search auto-complete inputs). happy rawat javascript interview questions pdf free upd
The output will be undefined , not a ReferenceError or 5 . Due to hoisting, the declaration var myVar is lifted to the top, but its assignment ( = 5 ) stays in place. The code is interpreted as:
Static PDFs are great for reading, but look for resources linked to interactive environments like CodeSandbox, StackBlitz, or GitHub Gists so you can run the code live. Step-by-Step Strategy to Ace Your Frontend Interview Every JavaScript object contains a private property pointing
// Infinite Currying Question: add(1)(2)(3)...() function add(a) return function(b) if (b !== undefined) return add(a + b); return a; ; console.log(add(2)(3)(4)()); // 9 Use code with caution. Memoization
console.log(a); // Outputs: undefined (due to hoisting) var a = 10; console.log(b); // Throws ReferenceError: Cannot access 'b' before initialization let b = 20; Use code with caution. Closures and Lexical Scope (Perfect for search auto-complete inputs)
Currying is a functional programming technique where a function that takes multiple arguments is transformed into a sequence of nesting functions, each taking a single argument at a time.
function outerFunction(outerVariable) return function innerFunction(innerVariable) console.log(`Outer: $outerVariable, Inner: $innerVariable`); ; const newFunction = outerFunction('outside'); newFunction('inside'); // Logs: Outer: outside, Inner: inside Use code with caution.
: Invokes the function immediately. Pass arguments inside a single array.