cf.completefrontend
JAVASCRIPT INTERVIEWS

JavaScript interview questions

300 questions about JavaScript itself, the way interviewers ask them: 112 to explain, 110 where you predict what the code logs, and 78 where you write the function. 106 easy, 133 medium, and 61 hard.

Every question is free to read. Sign in with Google to see the answers: the short version to say in the interview, why it's true, and what they'll ask next.

300 of 300 questions

Types & coercion

  1. What are the primitive types in JavaScript?ConceptEasy
  2. What does typeof return for null, arrays, classes, and undeclared variables?Predict the outputEasy
  3. What's the difference between null and undefined?ConceptEasy
  4. Which values are falsy in JavaScript?ConceptEasy
  5. What's the difference between == and ===?ConceptEasy
  6. What do + and - do when you mix strings and numbers?Predict the outputEasy
  7. What do these string comparisons with < log?Predict the outputEasy
  8. What's the difference between isNaN and Number.isNaN?ConceptEasy
  9. Write getType(value) that returns a precise type name, telling null, arrays, and dates apart.Write the codeEasy
  10. What do these comparisons of null and undefined with 0 log?Predict the outputMedium
  11. What do these == comparisons log, including [] == ![]?Predict the outputMedium
  12. What does + give when you add arrays and objects, like [] + {}?Predict the outputMedium
  13. What's the difference between String(value), value.toString(), and value + ""?ConceptMedium
  14. What do parseInt and Number return for strings like "12px", "", and "1e3"?Predict the outputMedium
  15. What does ["1", "2", "3"].map(parseInt) return?Predict the outputMedium
  16. Why is 0.1 + 0.2 === 0.3 false, and how do you compare decimals safely?ConceptMedium
  17. What does toFixed return for 0.1 + 0.2 and for 1.005?Predict the outputMedium
  18. What is Number.MAX_SAFE_INTEGER, and when do you need BigInt?ConceptMedium
  19. How can you call methods like toUpperCase on a string if primitives aren't objects?ConceptMedium
  20. Write objectIs(a, b), a polyfill for Object.is, without calling Object.is.Write the codeMedium
  21. How does JavaScript convert an object to a primitive?ConceptHard
  22. Which of valueOf and toString runs for +, template literals, and *?Predict the outputHard
  23. What happens past Number.MAX_SAFE_INTEGER, and when you mix BigInts with numbers?Predict the outputHard
  24. How do ===, Object.is, and string conversion treat -0?Predict the outputHard
  25. Write looseEquals(a, b) that returns the same result as a == b, without using == or !=.Write the codeHard

Scope & hoisting

  1. What are the differences between var, let, and const?ConceptEasy
  2. What's the difference between function scope and block scope?ConceptEasy
  3. What is hoisting in JavaScript?ConceptEasy
  4. What does this log when a var and a function are used before they're declared?Predict the outputEasy
  5. What does this log when a function declaration and a function expression are both called before their lines?Predict the outputEasy
  6. Does const make a value immutable?ConceptEasy
  7. Which of these top-level declarations become properties of window?Predict the outputEasy
  8. What do these two loops log when each one schedules a setTimeout per iteration?Predict the outputEasy
  9. Fix createHandlers so each returned function reports its own index and name.Write the codeEasy
  10. What is the temporal dead zone?ConceptMedium
  11. What does this log when a function reads a name that it declares with const further down?Predict the outputMedium
  12. What is variable shadowing, and when is it not allowed?ConceptMedium
  13. What does this log when a function declares a var inside an if (false) block?Predict the outputMedium
  14. What is lexical scope, and how does the scope chain find a variable?ConceptMedium
  15. What does this log when a var and two function declarations share the same name?Predict the outputMedium
  16. What does this script log when it declares var a twice and let b twice?Predict the outputMedium
  17. What is an implicit global, and how do you prevent one?ConceptMedium
  18. What does var a = b = 5 inside a function leave behind in the global scope?Predict the outputMedium
  19. Fix sum and sumRows so they return the right total and stop leaking globals.Write the codeMedium
  20. Are class declarations hoisted?ConceptMedium
  21. What do these timers log when the loop body also increments the let counter?Predict the outputHard
  22. What does this log when a var inside a catch block has the same name as the catch parameter?Predict the outputHard
  23. What does this log when a function is declared inside a block in a non-strict script?Predict the outputHard
  24. What does this log when a default parameter's closure and the function body both use x?Predict the outputHard
  25. How do eval and with affect scope, and why are they avoided?ConceptHard

Functions & closures

  1. What does it mean that functions are first-class in JavaScript, and what is a higher-order function?ConceptEasy
  2. What is a closure, and what would you use one for?ConceptEasy
  3. What does this greeter log after the variable it closes over changes?Predict the outputEasy
  4. What do these two wallets created by the same factory log?Predict the outputEasy
  5. Write makeCounter(start): a counter with increment, decrement, reset, and value methods and private state.Write the codeEasy
  6. Write createIdGenerator(prefix): each generator returns unique, increasing ids like user-1, user-2.Write the codeEasy
  7. Write once(fn): a function that runs fn only the first time it's called.Write the codeEasy
  8. What is an IIFE, and how does the module pattern use one?ConceptEasy
  9. What is a pure function, and why does it matter?ConceptEasy
  10. What are the differences between a function declaration, a function expression, and an arrow function?ConceptMedium
  11. What's the difference between the arguments object and rest parameters?ConceptMedium
  12. What does this function with a default array parameter log?Predict the outputMedium
  13. What do length and name report for these functions?Predict the outputMedium
  14. What does this counter log for its count property after a few increments?Predict the outputMedium
  15. What is a stale closure, and how do you fix one?ConceptMedium
  16. Write partial(fn, ...presetArgs), with partial.placeholder to leave gaps you fill in later.Write the codeMedium
  17. Write sum so that sum(1)(2)(3)() returns 6: it keeps adding until it's called with no arguments.Write the codeMedium
  18. Write memoizeOne(fn): cache only the most recent call, and recompute when the arguments change.Write the codeMedium
  19. In what order does this recursive countdown log?Predict the outputMedium
  20. What causes "Maximum call stack size exceeded", and how do you avoid it in recursive code?ConceptMedium
  21. What does this log after the variables holding two recursive functions are reassigned?Predict the outputHard
  22. What does writing to arguments[0] do to the parameter in each of these functions?Predict the outputHard
  23. What does this script with a function expression and an IIFE log?Predict the outputHard
  24. Can closures cause memory leaks? How, and how do you prevent them?ConceptHard
  25. Write trampoline(fn) so a recursive function can run a million steps deep without overflowing the stack.Write the codeHard

this & binding

  1. How does JavaScript decide what this refers to?ConceptEasy
  2. What does this log when you call a method through a variable?Predict the outputEasy
  3. What is this in a plain function call, in sloppy mode and in strict mode?Predict the outputEasy
  4. What's the difference between call, apply, and bind?ConceptEasy
  5. How does this work inside an arrow function?ConceptEasy
  6. What does this log when an object has a regular method and an arrow function property?Predict the outputEasy
  7. What is globalThis, and why was it added?ConceptEasy
  8. What does this chain of method calls log, and where does it break?Predict the outputEasy
  9. Write calculator(start), whose methods can be chained: calculator(2).add(3).multiply(4).value().Write the codeEasy
  10. When more than one this binding rule could apply, which one wins?ConceptMedium
  11. Why does a method lose its this when you pass it as a callback, and how do you fix it?ConceptMedium
  12. What does a nested function inside a method see as this, compared with a nested arrow?Predict the outputMedium
  13. What do these two setTimeout callbacks log for this.label?Predict the outputMedium
  14. What does map return here, with and without its second argument?Predict the outputMedium
  15. Can you change the this of a function that's already bound? What does this log?Predict the outputMedium
  16. Can call or bind change the this of an arrow function? What does this log?Predict the outputMedium
  17. Implement Function.prototype.myCall without using call, apply, or bind.Write the codeMedium
  18. Implement Function.prototype.myApply without using call, apply, or bind.Write the codeMedium
  19. What happens when you destructure a class method and a class-field arrow off an instance and call them?Predict the outputMedium
  20. What is this inside a DOM event listener?ConceptMedium
  21. What does this log when you call a bound constructor with and without new?Predict the outputHard
  22. Implement Function.prototype.myBind, including support for new.Write the codeHard
  23. Which of these calls keep this: parentheses, the comma operator, or an assignment?Predict the outputHard
  24. Should you define class methods as arrow function fields so they stay bound? What are the trade-offs?ConceptHard
  25. A parent constructor calls this.init() and the child defines init as an arrow field. What does this log?Predict the outputHard

Objects & prototypes

  1. How does the prototype chain work?ConceptEasy
  2. What's the difference between __proto__ and prototype?ConceptEasy
  3. What does this log when objects are used as property keys?Predict the outputEasy
  4. What do for...in, Object.keys, and Reflect.ownKeys list for this object?Predict the outputEasy
  5. Why put methods on the prototype instead of creating them in the constructor?ConceptEasy
  6. What are getters and setters, and when would you use them?ConceptEasy
  7. What's the difference between Object.freeze, Object.seal, and Object.preventExtensions?ConceptEasy
  8. What does this log after trying to change a frozen object?Predict the outputEasy
  9. Write a Shape base class with Circle and Rectangle subclasses that each compute their own area.Write the codeEasy
  10. What does this log when an array is put on a constructor's prototype?Predict the outputMedium
  11. What does this log when a constructor returns a value?Predict the outputMedium
  12. Implement myNew(Constructor, ...args) so it does what the new operator does.Write the codeMedium
  13. Write objectCreate(proto, properties), a polyfill for Object.create.Write the codeMedium
  14. Implement myInstanceOf(value, Constructor) so it works like the instanceof operator.Write the codeMedium
  15. Without class, make a Dog constructor inherit from Animal using prototypes.Write the codeMedium
  16. What are property descriptors, and what do writable, enumerable, and configurable mean?ConceptMedium
  17. In what order does Object.keys list these properties?Predict the outputMedium
  18. What's the difference between a shallow and a deep copy of an object, and how do you make each?ConceptMedium
  19. What does JSON.stringify produce for this object?Predict the outputMedium
  20. How do private #fields work, and how are they different from _underscore properties or closures?ConceptMedium
  21. Are JavaScript classes just syntactic sugar over constructor functions?ConceptHard
  22. What do extends and super actually do?ConceptHard
  23. What does this log when a base class constructor calls a method that the subclass overrides?Predict the outputHard
  24. What does this log when a static method updates this.count through a subclass?Predict the outputHard
  25. Write mixin(Target, ...sources) that adds methods, getters, and setters from plain objects to a class.Write the codeHard

Arrays & iteration

  1. What's the difference between map and forEach?ConceptEasy
  2. What does this log when the forEach and map callbacks return early?Predict the outputEasy
  3. What's the difference between slice and splice?ConceptEasy
  4. What's the difference between for...in and for...of, and which should you use on an array?ConceptEasy
  5. What does sort() with no comparator do to an array of numbers?Predict the outputEasy
  6. What do indexOf, includes, every, and some return in these edge cases?Predict the outputEasy
  7. How do you remove duplicates from an array?ConceptEasy
  8. Write chunk(array, size) that splits an array into groups of size elements.Write the codeEasy
  9. Write a generator range(start, end, step) that yields numbers from start up to, but not including, end.Write the codeEasy
  10. How do you write a comparator for sort, and what are the common mistakes?ConceptMedium
  11. Which array methods mutate the array, and what are toSorted, toReversed, toSpliced, and with?ConceptMedium
  12. What does reduce do here when you don't pass an initial value?Predict the outputMedium
  13. What does this log for a grid built with fill([]) and one built with Array.from?Predict the outputMedium
  14. What does this log about new Array(n), Array.of, and writing to length?Predict the outputMedium
  15. What do these flat and flatMap calls return?Predict the outputMedium
  16. What is an array-like object, and how do you turn one into a real array?ConceptMedium
  17. Implement Array.prototype.map yourself, as myMap.Write the codeMedium
  18. Write groupBy(items, getKey) that groups items into an object of arrays, without using Object.groupBy.Write the codeMedium
  19. Write rotate(array, k) that rotates an array k steps to the right.Write the codeMedium
  20. What does this generator log when you pass values into next()?Predict the outputMedium
  21. What is the iteration protocol, and what's the difference between an iterable and an iterator?ConceptHard
  22. How do array methods treat the hole in [1, , 3]?Predict the outputHard
  23. What does this log when you break out of a loop over a generator and then reuse it?Predict the outputHard
  24. Implement Array.prototype.reduce yourself, as myReduce.Write the codeHard
  25. Write a Range class whose instances work with for...of and spread, without using a generator.Write the codeHard

The event loop

  1. What is the event loop?ConceptEasy
  2. Does setTimeout(fn, 0) run fn before the next line? What does this log?Predict the outputEasy
  3. In what order do a resolved promise's then and a zero-delay setTimeout run?Predict the outputEasy
  4. What's the difference between a task and a microtask?ConceptEasy
  5. When does a promise's executor run, and when does its then callback run?Predict the outputEasy
  6. How much of an async function runs before its caller continues?Predict the outputEasy
  7. Several timers with different delays: in what order do they fire?Predict the outputEasy
  8. The script throws an uncaught error. Do the callbacks it already scheduled still run?Predict the outputEasy
  9. What happens when a long synchronous function blocks the main thread, and how do you avoid it?ConceptEasy
  10. A promise callback queues another microtask. Does it still run before a pending timeout?Predict the outputMedium
  11. Two promise chains start at the same time. How do their callbacks interleave?Predict the outputMedium
  12. Timers queue promises and promises queue timers here. In what order does it log?Predict the outputMedium
  13. What does the classic async1/async2 ordering puzzle log?Predict the outputMedium
  14. An async function awaits another async function. How does it interleave with a then chain?Predict the outputMedium
  15. A promise is resolved inside a timer. When does the code after its await run?Predict the outputMedium
  16. Does setTimeout(fn, 1000) run fn after exactly 1000 ms?ConceptMedium
  17. What's the difference between setInterval and a recursive setTimeout, and why do timers drift?ConceptMedium
  18. Where does requestAnimationFrame run in the event loop?ConceptMedium
  19. Write processInChunks(items, fn, chunkSize): map a large array without blocking the main thread.Write the codeMedium
  20. Write createBatcher(flush): collect values scheduled in the same synchronous run and pass them to flush once, in a microtask.Write the codeMedium
  21. Timers inside microtasks and microtasks inside timers: in what order do the letters log?Predict the outputHard
  22. A then callback returns an already-resolved promise. Where does its value show up among the numbers?Predict the outputHard
  23. A then callback schedules timers and returns a promise that a timer resolves. What's the order?Predict the outputHard
  24. What is microtask starvation, and how can a loop of promises freeze the page?ConceptHard
  25. In Node.js, where do process.nextTick and setImmediate fit in the event loop?ConceptHard

Promises & async/await

  1. What are the three states of a promise, and how is resolved different from fulfilled?ConceptEasy
  2. What does this log when the executor calls resolve twice and then reject?Predict the outputEasy
  3. What does then return, and how does that make promise chaining work?ConceptEasy
  4. What does this promise chain log when one then callback forgets to return?Predict the outputEasy
  5. Which callbacks in this chain run after a then callback throws?Predict the outputEasy
  6. What does an async function return, and what does await do?ConceptEasy
  7. Write promisify(fn): turn a Node-style callback function into one that returns a promise.Write the codeEasy
  8. Write runInSeries(tasks): run async functions one after another and collect their results.Write the codeEasy
  9. Write promiseRace(iterable), a polyfill for Promise.race.Write the codeEasy
  10. What does this log, and why doesn't the first then's error handler catch the error?Predict the outputMedium
  11. What does finally do with return values and errors in this code?Predict the outputMedium
  12. These two awaits run one after the other. How do you make them run in parallel?ConceptMedium
  13. What does this log when forEach is given an async callback?Predict the outputMedium
  14. What's the difference between Promise.all, Promise.allSettled, Promise.race, and Promise.any?ConceptMedium
  15. Write promiseAll(iterable), a polyfill for Promise.all.Write the codeMedium
  16. Write promiseAllSettled(iterable), a polyfill for Promise.allSettled.Write the codeMedium
  17. Write promiseAny(iterable), a polyfill for Promise.any.Write the codeMedium
  18. Write withTimeout(promise, ms): reject if a promise takes longer than ms to settle.Write the codeMedium
  19. Write retry(fn, { retries, delay }): call an async function again when it fails.Write the codeMedium
  20. What are async iterators, and when would you use for await...of?ConceptMedium
  21. What is an unhandled promise rejection, and how do you avoid one?ConceptHard
  22. What does this log when you await an object that has a then method?Predict the outputHard
  23. What does this log, and why does only one of these try/catch blocks catch the rejection?Predict the outputHard
  24. Promises can't be cancelled. How do you make your own async function cancellable with AbortController?ConceptHard
  25. Write mapWithLimit(items, limit, fn): run an async function over a list, at most limit calls at a time.Write the codeHard

Modern syntax & collections

  1. What's the difference between ?? and ||?ConceptEasy
  2. What does optional chaining (?.) do?ConceptEasy
  3. What is destructuring, and how do defaults and renaming work?ConceptEasy
  4. Which variables does this nested destructuring with renaming create?Predict the outputEasy
  5. What's the difference between spread and rest syntax?ConceptEasy
  6. What do these object spreads produce when keys overlap?Predict the outputEasy
  7. What does this object literal with computed keys log?Predict the outputEasy
  8. What do at() and bracket access return for these indexes?Predict the outputEasy
  9. Write pick(obj, keys) and omit(obj, keys).Write the codeEasy
  10. Which destructuring defaults are used here, and what happens with null?Predict the outputMedium
  11. When would you use a Map instead of a plain object?ConceptMedium
  12. How do Map and Set compare keys in this snippet?Predict the outputMedium
  13. Write countWords(text): count how often each word appears, using a Map.Write the codeMedium
  14. Write union, intersection, and difference for two Sets.Write the codeMedium
  15. What is a Symbol, and what would you use one for?ConceptMedium
  16. Which of these operations see a symbol-keyed property?Predict the outputMedium
  17. What is a WeakMap, and when would you use one instead of a Map?ConceptMedium
  18. What does Object.groupBy return in this example?Predict the outputMedium
  19. How do tagged templates work, and what does the tag function receive?ConceptMedium
  20. What does this tag function receive and return?Predict the outputHard
  21. Write an html tagged template that escapes every interpolated value.Write the codeMedium
  22. How far does optional chaining short-circuit in this code?Predict the outputHard
  23. What do ||=, ??=, and &&= do here, including on a const?Predict the outputHard
  24. Why does the second destructuring swap here fail?Predict the outputHard
  25. What are WeakRef and FinalizationRegistry, and why should you rarely use them?ConceptHard

Errors, strict mode & modules

  1. How do try, catch, and finally work together?ConceptEasy
  2. In what order do try, catch, and finally log when catch returns?Predict the outputEasy
  3. Which built-in error type does each of these mistakes throw?Predict the outputEasy
  4. What does catch receive when the code throws a string or a plain object?Predict the outputEasy
  5. Can you write a catch block without an error variable, and when would you?ConceptEasy
  6. Write safeJsonParse(text) that returns [error, value] instead of throwing.Write the codeEasy
  7. Write an assert(condition, message) helper that throws an AssertionError when the condition is falsy.Write the codeEasy
  8. What is strict mode, and how do you turn it on?ConceptEasy
  9. What's the difference between named and default exports?ConceptEasy
  10. What happens when finally has its own return?Predict the outputMedium
  11. Does this try/catch catch the error thrown in the setTimeout callback?Predict the outputMedium
  12. What does error.cause give you when you wrap one error in another?Predict the outputMedium
  13. This catch handles only one kind of error. What gets logged?Predict the outputMedium
  14. Build an error class hierarchy: a base AppError with ValidationError and NotFoundError subclasses.Write the codeMedium
  15. How do you catch errors that nothing else handled, with the error and unhandledrejection events?ConceptMedium
  16. What are the differences between ES modules and CommonJS?ConceptMedium
  17. What does it mean that ES module imports are live bindings?ConceptMedium
  18. How is the top level of an ES module different from the top level of a classic script?ConceptMedium
  19. How does <script type="module"> behave differently from a classic <script>?ConceptMedium
  20. What is dynamic import(), and when would you use it?ConceptMedium
  21. Does changing a variable in finally change what the function returns?Predict the outputHard
  22. What does this log, given that one function runs in strict mode and the other doesn't?Predict the outputHard
  23. Imports in ES modules are hoisted. What does that mean, and in what order do these modules run?ConceptHard
  24. What happens when two ES modules import each other?ConceptHard
  25. What is tree shaking, and what can stop it from working?ConceptHard

Browser & DOM

  1. What are event bubbling and capturing?ConceptEasy
  2. What is event delegation, and why would you use it?ConceptEasy
  3. Why doesn't removeEventListener remove my listener?ConceptEasy
  4. What's the difference between DOMContentLoaded and load?ConceptEasy
  5. What's the difference between innerHTML and textContent, and why does it matter for security?ConceptEasy
  6. Write escapeHtml(str) so a string can be safely put inside HTML.Write the codeEasy
  7. What's the difference between localStorage, sessionStorage, and cookies?ConceptEasy
  8. Does fetch reject when the server responds with a 404 or a 500?ConceptEasy
  9. Write toQueryString(params) that turns an object into a URL query string.Write the codeEasy
  10. What's the difference between stopPropagation, stopImmediatePropagation, and preventDefault?ConceptMedium
  11. What are passive event listeners, and why do they make scrolling smoother?ConceptMedium
  12. How do you create and dispatch a custom DOM event?ConceptMedium
  13. Write delegate(root, type, selector, handler) for event delegation.Write the codeMedium
  14. What's the difference between a plain <script>, <script async>, and <script defer>?ConceptMedium
  15. How do you cancel a fetch request, and how do you give it a timeout?ConceptMedium
  16. Write parseQuery(query) that turns a URL query string into an object.Write the codeMedium
  17. Write a localStorage wrapper whose entries expire after a given time.Write the codeMedium
  18. Why use IntersectionObserver instead of a scroll listener to detect when an element becomes visible?ConceptMedium
  19. How do you animate with requestAnimationFrame, and why is it better than setInterval?ConceptMedium
  20. What are Web Workers, and when would you use one?ConceptMedium
  21. What are reflow and repaint, and what is layout thrashing?ConceptHard
  22. What is the same-origin policy, and how does CORS work, including preflight requests?ConceptHard
  23. How do you communicate safely between windows or iframes with postMessage?ConceptHard
  24. What causes memory leaks in a frontend app, and how do you find them?ConceptHard
  25. Write a tiny client-side router that matches paths like /users/:id.Write the codeHard

Coding challenges

  1. Write debounce(fn, wait): call fn only after wait ms have passed without another call.Write the codeEasy
  2. Write flatten(array, depth) to flatten nested arrays up to depth levels, without using flat.Write the codeEasy
  3. Write pipe(...fns) and compose(...fns) that combine functions into one.Write the codeEasy
  4. Write get(object, path, defaultValue) to read a nested value by a path like a.b[0].c.Write the codeEasy
  5. Write classNames(...args) to build a CSS class string from strings, objects, and arrays.Write the codeEasy
  6. Write deepFreeze(object) so that an object and everything reachable from it is frozen.Write the codeEasy
  7. Write uniqueBy(array, key) to remove duplicates by a computed key, keeping the first of each.Write the codeEasy
  8. Write throttle(fn, wait) so that fn runs at most once every wait ms.Write the codeMedium
  9. Write memoize(fn, resolver) that caches results by a key computed from the arguments.Write the codeMedium
  10. Write curry(fn) that collects arguments over several calls until it has fn.length of them.Write the codeMedium
  11. Write set(object, path, value) to write a nested value, creating missing objects and arrays on the way.Write the codeMedium
  12. Write flattenObject(object) to turn a nested object into a single level with dotted keys.Write the codeMedium
  13. Write unflattenObject(object) to rebuild a nested object from dotted keys.Write the codeMedium
  14. Write render(template, data) that fills {{ path }} placeholders with values from data.Write the codeMedium
  15. Write camelCase(text) and kebabCase(text) to convert between naming styles.Write the codeMedium
  16. Write an EventEmitter class with on, off, once, and emit.Write the codeMedium
  17. Implement an LRUCache class with get and put that evicts the least recently used entry.Write the codeMedium
  18. Write a Redux-style createStore(reducer, initialState) with getState, dispatch, and subscribe.Write the codeMedium
  19. Write a minimal Observable class with subscribe, unsubscribe, teardown, and a map method.Write the codeMedium
  20. Write debounce(fn, wait, { leading, trailing }) with cancel() and flush() methods.Write the codeHard
  21. Extend curry(fn) with a placeholder, so add3(_, 2)(1, 3) fills the skipped argument later.Write the codeHard
  22. Write deepEqual(a, b) that compares values structurally, including Map, Set, Date, and cyclic objects.Write the codeHard
  23. Write deepClone(value) that copies nested data and handles cycles, Map, Set, and Date.Write the codeHard
  24. Implement an LRU cache with O(1) get and put using a hash map and a doubly linked list.Write the codeHard
  25. Build tiny reactive signals: signal, computed, and effect with automatic dependency tracking.Write the codeHard