Search IOCombats

Search challenges, guides, questions and articles

Javascript Interview Questions

46 curated javascript interview questions with detailed answers and examples.

← Browse all interview questions

Understand forced synchronous layout, the read-write interleaving that triggers it, and the batching and containment strategies that eliminate it.

advancedperformancecssperformancelayout-thrashing

Learn how to transform functions into reusable, smaller functions using currying and partial application.

advancedadvanced conceptsjavascriptfunctional programmingcurrying

Learn how to control function execution rates using debouncing and throttling for performance optimization.

advancedadvanced conceptsjavascriptperformancedebounce

Learn how event delegation lets you handle events efficiently by listening on a parent instead of multiple child elements.

advancedadvanced conceptsjavascripteventsdom

Understand how JavaScript automatically frees memory using reachability and reference checks.

advancedadvanced conceptsjavascriptmemorygarbage collection

Learn how iterators define custom iteration behavior and how generators make writing them easier.

advancedadvanced conceptsjavascriptgeneratorsiterators

Learn what causes memory leaks in JavaScript and how to prevent them in web apps and Node.js.

advancedadvanced conceptsjavascriptmemory leaksperformance

Understand the difference between microtasks and macrotasks in the JavaScript event loop.

advancedadvanced conceptsjavascriptevent loopasync

Understand the difference between shallow and deep copying, and how reference types affect data duplication.

advancedadvanced conceptsjavascriptobjectsdeep copy

Understand how WeakMap and WeakSet help with memory-safe key/value storage using weak references.

advancedadvanced conceptsjavascriptweakmapweakset

Learn how Web Workers enable multi-threaded behavior in JavaScript for heavy computations.

advancedadvanced conceptsjavascriptweb workersthreads

Learn how to limit concurrent async operations in JavaScript using async queues and promise batching.

advancedasync and-promisesjavascriptpromisesasync-await

Learn to build a robust retry mechanism for failed API calls, handling transient network errors gracefully.

intermediateasync and-promisesjavascriptpromisesretry

Understand how JavaScript handles tasks, microtasks, and macrotasks and how to predict async execution order.

intermediateasync and-promisesjavascriptevent looppromises

Avoid inconsistent state in JavaScript apps by managing promise resolution order in concurrent async operations.

intermediateasync and-promisesjavascriptasyncrace condition

Prevent multiple token refreshes when parallel API calls fail by sharing a single refresh promise.

advancedasync and-promisesjavascriptauthenticationpromises

Implement a robust deep-clone that handles Dates, RegExps, and circular references, and know the tradeoffs.

advancedbrowser and-domjavascriptdeep cloneobjects

Use event delegation to reduce listeners, support dynamic elements, and improve performance with advanced patterns.

intermediatebrowser and-domjavascriptevent delegationdom

Diagnose memory growth, understand mark-and-sweep, and apply strategies to prevent leaks in web apps and Node services.

advancedbrowser and-domjavascriptmemorygarbage collection

Build a lightweight lazy-loading system that defers image downloads until images approach the viewport.

intermediatebrowser and-domjavascriptlazy-loadingimages

Move CPU-heavy tasks off the main thread with Web Workers, error handling, transferable objects, and fallback strategies.

advancedbrowser and-domjavascriptweb workersperformance

Understand the differences in scope, this binding, and syntax between arrow and traditional functions.

beginnerfundamentalsjavascriptarrow functionsthis

Learn how callback functions work and why they are essential for asynchronous programming in JavaScript.

beginnerfundamentalsjavascriptcallbacksasynchronous

Explore different ways to clone objects and arrays without mutating the original data.

beginnerfundamentalsjavascriptcloneobjects

Understand the primitive and non-primitive data types in JavaScript and how they differ.

beginnerfundamentalsjavascriptdata typesbasics

Learn why strict equality (===) avoids unexpected type coercion in JavaScript.

beginnerfundamentalsjavascriptequalitytype coercion

Learn how JavaScript moves variable and function declarations to the top of their scope.

beginnerfundamentalsjavascripthoistingscope

Learn how variable declarations differ in scope and behavior in modern JavaScript.

beginnerfundamentalsjavascriptscopevariables

Understand how spread and rest operators simplify working with arrays, objects, and functions.

beginnerfundamentalsjavascriptspreadrest

Master ES6 template literals for cleaner string concatenation and embedded expressions.

beginnerfundamentalsjavascripttemplate literalses6

Learn which values evaluate to true or false in JavaScript conditionals.

beginnerfundamentalsjavascripttruthyfalsy

Learn how async/await simplifies asynchronous JavaScript code built on top of Promises.

intermediateintermediate conceptsjavascriptasync/awaitpromises

Learn how call, apply, and bind control the "this" context and pass arguments to functions dynamically.

intermediateintermediate conceptsjavascriptthisfunctions

Understand closures in JavaScript — how inner functions remember variables from their parent scope.

intermediateintermediate conceptsjavascriptclosuresscope

Learn how destructuring assignment simplifies extracting values from arrays and objects.

intermediateintermediate conceptsjavascriptdestructuringes6

Understand how the JavaScript event loop handles asynchronous operations and manages concurrency.

intermediateintermediate conceptsjavascriptevent loopconcurrency

Understand higher-order functions — functions that take or return other functions for composable code.

intermediateintermediate conceptsjavascripthigher-order functionsfunctional programming

Learn how map, filter, and reduce work in JavaScript and when to use each for transforming arrays.

intermediateintermediate conceptsjavascriptarraysfunctional programming

Understand how Promises handle asynchronous operations in JavaScript and replace callback hell.

intermediateintermediate conceptsjavascriptpromisesasync

Understand how JavaScript inheritance works using the prototype chain and __proto__ references.

intermediateintermediate conceptsjavascriptprototypesinheritance

Understand how the this keyword behaves in different contexts — global, function, arrow, and class scopes.

intermediateintermediate conceptsjavascriptthisscope

Learn how to create a custom debounce function that supports leading-edge, trailing-edge, or both firing modes.

intermediateperformance optimizationjavascriptdebounceperformance

Learn how memory leaks occur in single-page apps, how to diagnose them with Chrome DevTools, and how to fix common leak sources.

advancedperformance optimizationjavascriptmemory leaksdevtools

Implement efficient infinite scrolling using IntersectionObserver, batching, and virtualized rendering.

advancedperformance optimizationjavascriptinfinite scrollperformance

Build a high-performance resize handler using timestamp-based throttle and requestAnimationFrame to avoid layout thrashing.

intermediateperformance optimizationjavascriptthrottleresize

Process large datasets without freezing the UI using setTimeout, requestIdleCallback, or Web Workers.

advancedperformance optimizationjavascripttime slicingrequestIdleCallback