We use cookies for site analytics. Accept to help us understand how the site is used. See our Privacy Policy for details.
Practice JavaScript questions covering closures, the event loop, prototypes, async/await, this binding, and the language quirks interviewers reach for.
Closures, the event loop and task queues, promises and async/await, prototypal inheritance, how 'this' is bound, hoisting and the temporal dead zone, equality and coercion, and array methods. Closures and the event loop are the two that appear in almost every JavaScript screen.
Yes. TypeScript compiles to JavaScript and every runtime behavior question - the event loop, closures, coercion, 'this' - is a JavaScript question. Interviewers routinely ask TypeScript candidates to explain what the emitted JavaScript actually does at runtime.
The event loop is how JavaScript runs asynchronous work on a single thread: the call stack empties, then microtasks (promise callbacks) drain, then one macrotask (timers, I/O) runs. It is asked constantly because it predicts output-ordering questions and explains real bugs like a blocked UI or a setTimeout(0) that runs after a resolved promise.
A closure is a function that retains access to variables from the scope where it was defined, even after that scope has returned. It underpins module patterns, once/memoize/debounce helpers, React hooks capturing stale values, and the classic loop-variable bug that 'let' fixes and 'var' does not.
For a normal function, 'this' is determined by how the function is called: as a method it is the object, standalone it is undefined in strict mode, with call/apply/bind it is what you pass, and with 'new' it is the new instance. Arrow functions have no own 'this' - they inherit it lexically, which is why they are the fix for callback binding bugs.
The difference between == and ===, why typeof null is 'object', why NaN !== NaN, how hoisting differs between var, let, and function declarations, why 0.1 + 0.2 !== 0.3, and how reference equality affects object and array comparison. These appear as short trick questions early in screens.