
When I was preparing for interviews, I collected hundreds of frontend coding questions into a giant spreadsheet. At some point I noticed something: the same ten or so questions kept showing up, just with different names and small twists.
Even better, those ten questions really come down to four patterns. Once you understand the pattern, a new variation stops being scary.

Pattern 1: Closures and timers
These questions test whether you understand that a function can hold onto private state between calls. That’s a closure.
1. Debounce
Run a function only after calls have stopped for wait milliseconds. Classic use: search input.
function debounce(fn, wait) {
let timer;
return function (...args) {
clearTimeout(timer);
timer = setTimeout(() => fn.apply(this, args), wait);
};
}
What interviewers check: did you preserve this and the arguments? Then they’ll ask follow-ups like “add a cancel method” or “support a leading-edge call”. Practice the progression with Debounce I, II, and... premium content.
