Q1
Easy
Explain event bubbling vs event capturing in the browser DOM.
Event propagation happens in three phases: Capturing (event trickles down from window to target), Target, and Bubbling (event bubbles up from target back to window). Standard event listeners attach to the bubbling phase unless the third argument { capture: true } is passed.
Q2
Medium
What is the difference between debounce and throttle?
Debouncing ensures a function is not called until a specified delay has elapsed since the last time it was invoked (e.g. search input autocomplete).
Throttling guarantees a function is executed at most once within a specified time interval (e.g. window resize or scroll tracking).
function debounce(fn, delay) {
let timer;
return function (...args) {
clearTimeout(timer);
timer = setTimeout(() => fn.apply(this, args), delay);
};
}
Prepare for Live Technical Interviews
At DoxaTech Hub, students receive mock interview drills, resume reviews, and direct
coaching to ensure they pass rigorous engineering screens.
Join DoxaTech Today