Sector file // javascript
JAVASCRIPTDECODED.
Closures, async & the core
Easy
2 questionsWhy would you use performance.now() instead of Date.now() to measure how long a function takes to run?
Phone Screen ยท 364 views ยท perf-api, tricky, real-world
Why would you add { passive: true } to a scroll or touchstart listener, and what problem does it solve for scroll performance?
Frontend ยท 263 views ยท rendering, tricky, real-world
Medium
7 questionsDebounce vs throttle โ implement debounce
Frontend ยท Netflix ยท 3.7k views ยท javascript, performance
Set methods deep-dive: performance and mutability trade-offs vs manual loops?
DSA ยท 1.2k views ยท set, performance, es2024
Explain event delegation.
Frontend ยท 899 views ยท events, dom, performance
How would you use ResizeObserver to react to an element's size changing, without polling getBoundingClientRect() on every frame?
Frontend ยท 645 views ยท observers, tricky, real-world
How would you use IntersectionObserver to lazy-load images only as they scroll into the viewport?
Frontend ยท 543 views ยท observers, tricky, real-world
What causes layout thrashing when you read and write DOM properties in a loop, and how would you batch those operations to avoid it?
Frontend ยท 291 views ยท rendering, tricky, real-world
What is `scheduler.yield()` and how does it prevent main-thread blocking?
Frontend ยท 142 views ยท scheduler, performance, event-loop
Hard
3 questionsWhy can pushing a single non-numeric value into a large numeric array tank its performance in V8, and how would you avoid it?
System Design ยท 1.1k views ยท v8, tricky, real-world
How does V8 Array copy-on-write optimization work for `toSorted`/`toReversed`/`toSpliced`/`with`?
DSA ยท 224 views ยท v8, array, performance
What is debouncing and throttling?
Frontend ยท 113 views ยท performance, optimization, debouncing
Seen a JavaScript question that is not here? Add it and help the next candidate.
Share a question