← All topics

⚑ Interview Prep

JavaScript

Closures, this, promises, the event loop, and the utility functions front-end and full-stack interviews ask you to build by hand.

100 questions, most asked first

Ranked by how often each question comes up in real interviews. #1 is the most common.

#1What is a closure?Scope & closuresMediumFree#2Explain the event loopEvent loopMediumFree#3let vs const vs varScope & closuresEasyFree#4== vs ===Types & coercionEasyFree#5Implement debounceBuild it yourselfMediumFree#6How does `this` work?this & prototypesMediumFree#7Promises vs async/awaitAsync & promisesMediumFree#8What is hoisting?Scope & closuresEasyFree#9FizzBuzzArrays & objectsEasyFree#10Implement deepCloneReferences & copyingMediumFreeUnlock 90 more JavaScript questions Β· all 1,200 questions for $39/year (about 11Β’ a day)See full access#11Implement throttleBuild it yourselfMediumπŸ”’#12Implement Promise.allAsync & promisesMediumπŸ”’#13map, filter and reduceArrays & objectsEasyπŸ”’#14Prototypal inheritancethis & prototypesMediumπŸ”’#15null vs undefinedTypes & coercionEasyπŸ”’#16call, apply and bindthis & prototypesMediumπŸ”’#17Implement Function.prototype.bindthis & prototypesMediumπŸ”’#18Arrow functions vs regular functionsModern syntaxEasyπŸ”’#19Shallow copy vs deep copyReferences & copyingEasyπŸ”’#20Flatten a nested arrayBuild it yourselfMediumπŸ”’#21Implement memoizeBuild it yourselfMediumπŸ”’#22Implement curryBuild it yourselfMediumπŸ”’#23Spread vs rest (`...`)Modern syntaxEasyπŸ”’#24DestructuringModern syntaxEasyπŸ”’#25Truthy and falsy valuesTypes & coercionEasyπŸ”’#26typeof and checking typesTypes & coercionEasyπŸ”’#27Which array methods mutate?Arrays & objectsEasyπŸ”’#28Implement Array.prototype.mapBuild it yourselfEasyπŸ”’#29Implement Array.prototype.reduceBuild it yourselfMediumπŸ”’#30Promise.allSettled, race and anyAsync & promisesMediumπŸ”’#31Write a sleep functionAsync & promisesEasyπŸ”’#32Retry with exponential backoffAsync & promisesMediumπŸ”’#33Implement an EventEmitterBuild it yourselfMediumπŸ”’#34Implement groupByArrays & objectsEasyπŸ”’#35Chunk an arrayArrays & objectsEasyπŸ”’#36Remove duplicates from an arrayArrays & objectsEasyπŸ”’#37const vs Object.freezeReferences & copyingEasyπŸ”’#38Classes in JavaScriptthis & prototypesEasyπŸ”’#39Error handling in async codeAsync & promisesMediumπŸ”’#40Microtasks vs macrotasksEvent loopHardπŸ”’#41What does "use strict" do?Types & coercionEasyπŸ”’#42What is an IIFE?Scope & closuresEasyπŸ”’#43Pure functions and side effectsArrays & objectsEasyπŸ”’#44Higher-order functionsArrays & objectsEasyπŸ”’#45Lexical scope and the scope chainScope & closuresMediumπŸ”’#46Garbage collection and memory leaksReferences & copyingMediumπŸ”’#47WeakMap and WeakSetReferences & copyingMediumπŸ”’#48Map vs plain objectArrays & objectsEasyπŸ”’#49Set intersection, union and differenceArrays & objectsEasyπŸ”’#50What are Symbols?Types & coercionMediumπŸ”’#51Generators and iteratorsModern syntaxMediumπŸ”’#52for…in vs for…ofArrays & objectsEasyπŸ”’#53Optional chaining (?.) and nullish coalescing (??)Modern syntaxEasyπŸ”’#54Capitalize each wordArrays & objectsEasyπŸ”’#55Why is 0.1 + 0.2 !== 0.3?Types & coercionEasyπŸ”’#56NaNTypes & coercionEasyπŸ”’#57Implicit type coercionTypes & coercionMediumπŸ”’#58ES modules vs CommonJSModern syntaxMediumπŸ”’#59Promise chainingAsync & promisesMediumπŸ”’#60Implement a simple PromiseAsync & promisesHardπŸ”’#61Implement deepEqualBuild it yourselfMediumπŸ”’#62Implement onceBuild it yourselfEasyπŸ”’#63Implement pipe and composeBuild it yourselfEasyπŸ”’#64LRU Cache with a MapBuild it yourselfMediumπŸ”’#65Parse a query stringBuild it yourselfEasyπŸ”’#66Safely get a nested value (lodash.get)Build it yourselfEasyπŸ”’#67setTimeout vs setIntervalEvent loopEasyπŸ”’#68Implement promisifyAsync & promisesMediumπŸ”’#69Run async tasks with a concurrency limitAsync & promisesHardπŸ”’#70The Node.js event loop and non-blocking I/OEvent loopMediumπŸ”’#71Web Workers and the main threadEvent loopMediumπŸ”’#72The call stack and stack overflowEvent loopEasyπŸ”’#73The temporal dead zoneScope & closuresMediumπŸ”’#74Function declarations vs expressionsScope & closuresEasyπŸ”’#75JSON.stringify gotchasReferences & copyingMediumπŸ”’#76Why does [10, 1, 2].sort() look wrong?Arrays & objectsEasyπŸ”’#77Array length and holesArrays & objectsMediumπŸ”’#78instanceof vs typeofthis & prototypesEasyπŸ”’#79extends, super and method overridingthis & prototypesMediumπŸ”’#80Custom error classesthis & prototypesMediumπŸ”’#81Debounce vs throttle, when to use whichBuild it yourselfEasyπŸ”’#82Immutable updates of nested stateReferences & copyingMediumπŸ”’#83Composition over inheritancethis & prototypesMediumπŸ”’#84Validate input with a regular expressionArrays & objectsMediumπŸ”’#85JavaScript Date pitfallsTypes & coercionMediumπŸ”’#86Why use TypeScript?Modern syntaxEasyπŸ”’#87TypeScript interface vs typeModern syntaxMediumπŸ”’#88TypeScript genericsModern syntaxMediumπŸ”’#89any vs unknown vs neverTypes & coercionMediumπŸ”’#90Bundlers, tree shaking and code splittingModern syntaxMediumπŸ”’#91Add a timeout to any promiseAsync & promisesMediumπŸ”’#92Deduplicate in-flight requestsAsync & promisesMediumπŸ”’#93Implement deepFreezeReferences & copyingEasyπŸ”’#94Implement instanceofthis & prototypesMediumπŸ”’#95Most frequent characterArrays & objectsEasyπŸ”’#96Reverse a string and check palindromesArrays & objectsEasyπŸ”’#97Object.keys, values, entries and fromEntriesArrays & objectsEasyπŸ”’#98Sort objects by multiple keysArrays & objectsMediumπŸ”’#99Polyfills vs transpilingModern syntaxEasyπŸ”’#100Making JavaScript fasterEvent loopMediumπŸ”’