JavaScript interview questions
The language itself: event loop, closures, this, coercion, prototypes, and the classic utilities interviewers ask you to write. 143 free questions in 9 topics, each with its answer and an explanation once you have tried it.
0 of 143 solved
Topics
- Event loop & async · Guess the output (6), Quizzes (8), Coding drills (10), Flashcards (2)
- Closures & scope · Guess the output (11), Quizzes (3), Coding drills (4), Flashcards (2)
thisbinding · Guess the output (7), Quizzes (2), Coding drills (1), Put in order (1)- Hoisting & TDZ · Guess the output (6)
- Coercion & equality · Guess the output (7)
- Objects, prototypes & classes · Guess the output (19), Quizzes (7), Coding drills (5), Flashcards (2), Put in order (1)
- Iterators, generators & modern syntax · Guess the output (6), Quizzes (2), Coding drills (1), Flashcards (1)
- Performance & memory · Quizzes (5), Coding drills (2), Flashcards (3)
- Utilities & polyfills · Guess the output (2), Coding drills (17)
Event loop & async
0 / 26- Not attemptedSync vs microtask vs macrotask
- Not attemptedWhere does an async function pause?
- Not attemptedPromise executor runs sync; settles once
- Not attemptedWhat flows through finally?
- Not attemptedcatch, rethrow, recover
- Not attemptedTwo chains interleave
- Not attemptedMicrotask starvation
- Not attemptedWhere does requestAnimationFrame run?
- Not attemptedPicking a Promise combinator
- Not attemptedPromise.any
- Not attemptedStale search responses
- Not attemptedawait in a loop
- Not attemptedPromise.all polyfillDifficulty: medium
- Not attemptedRetry with exponential backoff + abortDifficulty: hard
- Not attemptedRun tasks with a concurrency limitDifficulty: hard
- Not attemptedWhat each combinator returns
- Not attemptedWhy promises beat callbacks
- Not attemptedThe event loop
- Not attemptedPromise states
- Not attemptedpromisifyDifficulty: easy
- Not attemptedPromise.allSettled polyfillDifficulty: easy
- Not attemptedPromise.any polyfillDifficulty: medium
- Not attemptedPromise.race polyfillDifficulty: easy
- Not attemptedRun async tasks in seriesDifficulty: easy
- Not attemptedsetInterval using setTimeoutDifficulty: easy
- Not attemptedBuild a Promise from scratchDifficulty: hard
Closures & scope
0 / 20- Not attemptedvar vs let in a loop with timers
- Not attemptedIndependent counters; destructured method
- Not attemptedClosure captures the variable, not the value
- Not attemptedArray of functions built with var
- Not attemptedLexical, not dynamic, scope
- Not attemptedClosure memory leak
- Not attemptedTDZ
- Not attemptedModule scope
- Not attemptedCurryDifficulty: easy
- Not attemptedMemoize with resolverDifficulty: easy
- Not attemptedIIFE shadowing and the typeof trap
- Not attemptedcatch parameter scope
- Not attemptedvar hoisting inside a nested IIFE
- Not attemptedClosures read the latest value; var is hoisted
- Not attemptedDefault parameters vs passing the object
- Not attemptedHow closures power React hooks
- Not attemptedWhat is a closure?
- Not attemptedStale closures in React
- Not attemptedonce()Difficulty: easy
- Not attemptedcreateCounter with private stateDifficulty: easy
this binding
0 / 11- Not attemptedMethod, detached, arrow, nested
- Not attemptedMethods passed to setTimeout
- Not attemptedbind vs call, double bind, new on a bound fn
- Not attemptedClass method vs class-field arrow, destructured
- Not attemptedRegular callback inside map, with and without thisArg
- Not attemptedMethod chaining, then detaching
- Not attemptedArrow function
this - Not attemptednew vs bind
- Not attemptedcall / apply / bind polyfillsDifficulty: medium
- Not attemptedThe
self = thispattern - Not attemptedPrecedence of
thisrules
Hoisting & TDZ
0 / 6Coercion & equality
0 / 7Objects, prototypes & classes
0 / 34- Not attemptedReassigning Fn.prototype after creating instances
- Not attemptedMUTATING the prototype instead
- Not attemptedOwn property shadows the prototype
- Not attemptedArray on the prototype is shared
- Not attemptedConstructor that returns something
- Not attemptedParent constructor calls an overridden method
- Not attemptedWalking the chain
- Not attemptedSpread vs structuredClone
- Not attemptedWhat JSON round-tripping loses
- Not attemptedObject.freeze in strict mode
- Not attemptedReference equality, NaN lookups, Set
- Not attemptedstructuredClone limits
- Not attemptedObject.freeze
- Not attemptedinstanceof
- Not attemptedClass fields and inheritance
- Not attemptedDeep equal (with circular refs)Difficulty: hard
- Not attemptedProperty flags in strict mode
- Not attemptedseal vs freeze
- Not attemptedGetters and setters
- Not attemptedProxy with a default value
- Not attemptedStatic methods are not on instances
- Not attemptedprivate # fields vs _protected
- Not attemptedObject.assign is shallow
- Not attemptedReturn values people forget
- Not attemptedMutability matrix
- Not attemptedProxy vs defineProperty
- Not attemptedsuper() in constructors
- Not attemptedWhat
new Foo()does - Not attemptedProperty descriptors
- Not attemptedPrototypal inheritance
- Not attemptedDeep clone (with cycles)Difficulty: medium
- Not attempteddeepFreezeDifficulty: easy
- Not attemptedType-check helpersDifficulty: easy
- Not attemptedNotesStore classDifficulty: easy
Iterators, generators & modern syntax
0 / 10- Not attemptedThe first next() argument is ignored
- Not attemptedtwo-way communication with yield
- Not attemptedAsking questions with a generator
- Not attemptedfor...of ignores the return value
- Not attemptedTagged template literals
- Not attemptedA hand-written iterator
- Not attemptedImported bindings are read-only
- Not attemptedGenerators vs async/await
- Not attemptedIterator protocol
- Not attemptedIterable range + lazy takeDifficulty: medium
Performance & memory
0 / 10- Not attemptedDebounce or throttle?
- Not attemptedWeakMap
- Not attemptedLong tasks
- Not attemptedCore Web Vitals
- Not attemptedCode splitting
- Not attemptedDebounce with cancel + flushDifficulty: medium
- Not attemptedThrottle (leading + trailing)Difficulty: medium
- Not attemptedGarbage collection
- Not attemptedMemory leaks in SPAs
- Not attemptedMaking assets load faster
Utilities & polyfills
0 / 19- Not attemptedFlatten to depth, iterativelyDifficulty: medium
- Not attemptedgetByPath (lodash.get)Difficulty: easy
- Not attemptedLRU cache, O(1)Difficulty: medium
- Not attemptedType-safe event emitterDifficulty: hard
- Not attemptedmap, filter and reduce polyfillsDifficulty: medium
- Not attemptedpipe and composeDifficulty: easy
- Not attemptedPartial applicationDifficulty: easy
- Not attemptedchunkDifficulty: easy
- Not attemptedgroupBy and countByDifficulty: easy
- Not attemptedFlatten a nested objectDifficulty: medium
- Not attemptedReplace {{placeholders}} deeplyDifficulty: medium
- Not attemptedSymmetric differenceDifficulty: easy
- Not attemptedexpect().toBe() chainDifficulty: easy
- Not attemptedat, find, findIndex, every, some, fillDifficulty: easy
- Not attemptedpick, omit, capitalize, reverse, splitDifficulty: easy
- Not attemptedPyramid pattern & inventory updateDifficulty: easy
- Not attemptedIterating a Map
- Not attemptedarguments and a promise that resolves synchronously
- Not attemptedconcat and forEach polyfillsDifficulty: easy
JavaScript interview questions: FAQ
- How many JavaScript interview questions are there?
- 143 questions in 9 topics: Guess the output (64), Quizzes (27), Coding drills (40), Flashcards (10), Put in order (2). All of them are free and need no login.
- What do the JavaScript questions cover?
- Event loop & async, Closures & scope, this binding, Hoisting & TDZ, Coercion & equality, Objects, prototypes & classes, Iterators, generators & modern syntax, Performance & memory and Utilities & polyfills.
- How should I practise JavaScript for a frontend interview?
- Go topic by topic and answer each question before you open its answer and explanation. Progress stays in your browser, so Review brings back the questions you missed, and a mock round mixes questions under a timer.