Sector file // javascript
JAVASCRIPTDECODED.
Closures, async & the core
Easy
8 questionsHow would you use Object.groupBy() to group an array of orders by status, and how does it compare to a manual reduce()?
Frontend ยท 1.2k views ยท es2024, tricky, real-world
How does Array.prototype.with() let you replace one array element immutably, and where would that pattern actually help?
Phone Screen ยท 1.1k views ยท es2023, tricky, real-world
How does 'use strict' change what `this` refers to inside a regular function called without a receiver, compared to non-strict mode?
Phone Screen ยท 1.1k views ยท syntax, tricky, real-world
How does Array.prototype.toSorted() differ from .sort(), and why does that matter when updating state immutably?
Phone Screen ยท 1.1k views ยท es2023, tricky, real-world
How would you use the Page Visibility API to pause a setInterval-based poller when a user switches to a different browser tab?
Phone Screen ยท 722 views ยท perf-api, tricky, real-world
Why 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
How does Array.prototype.toReversed() avoid the classic bug of accidentally mutating a shared array reference?
Phone Screen ยท 284 views ยท es2023, 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
14 questionsHow would you use the BroadcastChannel API to sync application state across multiple open browser tabs?
Frontend ยท 1.1k views ยท messaging, tricky, real-world
How would you write a Proxy 'set' trap that validates a value before allowing an assignment, and what happens if you return false?
Frontend ยท 1.1k views ยท proxy, tricky, real-world
How would you remove an item from an array immutably using toSpliced(), and how does it compare to splice()?
Frontend ยท 678 views ยท es2023, tricky, real-world
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
Why is navigator.sendBeacon() the right tool for sending analytics data when a user closes a tab, instead of a normal fetch call?
Frontend ยท 577 views ยท utility, 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
How would you use MutationObserver to detect when a third-party script injects new nodes into the DOM?
Frontend ยท 440 views ยท observers, tricky, real-world
How would you implement a debounce utility that also exposes a .cancel() method to cancel a pending call?
Frontend ยท 397 views ยท utility, tricky, real-world
Hard
8 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 SharedArrayBuffer let two Web Workers share memory directly, and what race conditions do you need to guard against?
System Design ยท 1.0k views ยท workers, tricky, real-world
How would you make a custom class iterable with for...of by implementing Symbol.iterator as a generator method?
DSA ยท 936 views ยท iterators, tricky, real-world
How would you write a deep-clone function that correctly handles a self-referencing (circular) object without infinite recursion?
DSA ยท 529 views ยท utility, tricky, real-world
How would you implement a throttle function with configurable leading- and trailing-edge execution?
Frontend ยท 332 views ยท utility, tricky, real-world
How would you transfer a large ArrayBuffer between a worker and the main thread without copying it, using postMessage's transfer list?
System Design ยท 324 views ยท workers, tricky, real-world
How would you implement Symbol.asyncIterator on a class to transparently page through a paginated API with for await...of?
DSA ยท 266 views ยท iterators, tricky, real-world
How would you implement a curry() function that supports partial application with placeholder arguments?
DSA ยท 255 views ยท functional, tricky, real-world
Seen a JavaScript question that is not here? Add it and help the next candidate.
Share a question