Sector file // javascript

JAVASCRIPTDECODED.

Closures, async & the core

165 Questions103.9k Views7.0k Upvotes
41 easy77 med47 hard

Easy

8 questions

How 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

How does Array.prototype.with() let you replace one array element immutably, and where would that pattern actually help?

Phone Screen ยท 1.1k views

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

How does Array.prototype.toSorted() differ from .sort(), and why does that matter when updating state immutably?

Phone Screen ยท 1.1k views

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

Why would you use performance.now() instead of Date.now() to measure how long a function takes to run?

Phone Screen ยท 364 views

How does Array.prototype.toReversed() avoid the classic bug of accidentally mutating a shared array reference?

Phone Screen ยท 284 views

Why would you add { passive: true } to a scroll or touchstart listener, and what problem does it solve for scroll performance?

Frontend ยท 263 views

Medium

14 questions

How would you use the BroadcastChannel API to sync application state across multiple open browser tabs?

Frontend ยท 1.1k views

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

How would you remove an item from an array immutably using toSpliced(), and how does it compare to splice()?

Frontend ยท 678 views

How would you use ResizeObserver to react to an element's size changing, without polling getBoundingClientRect() on every frame?

Frontend ยท 645 views

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

How would you use IntersectionObserver to lazy-load images only as they scroll into the viewport?

Frontend ยท 543 views

How would you use MutationObserver to detect when a third-party script injects new nodes into the DOM?

Frontend ยท 440 views

How would you implement a debounce utility that also exposes a .cancel() method to cancel a pending call?

Frontend ยท 397 views

Hard

8 questions

Why 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

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

How would you make a custom class iterable with for...of by implementing Symbol.iterator as a generator method?

DSA ยท 936 views

How would you write a deep-clone function that correctly handles a self-referencing (circular) object without infinite recursion?

DSA ยท 529 views

How would you implement a throttle function with configurable leading- and trailing-edge execution?

Frontend ยท 332 views

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

How would you implement Symbol.asyncIterator on a class to transparently page through a paginated API with for await...of?

DSA ยท 266 views

How would you implement a curry() function that supports partial application with placeholder arguments?

DSA ยท 255 views

Seen a JavaScript question that is not here? Add it and help the next candidate.

Share a question