Interview Q&A / JavaScript
JavaScript interview questions
Closures, the event loop, this, promises and the core language questions every frontend round asks.
Prefer rapid revision? Practise JavaScript short interview answers →
- What is the difference between debounce and throttle? Implement both.
Debounce waits until calls stop for a set time and then runs the function once, like search-as-you-type. Throttle runs the function at most once per time window no matter how often it is called, like handling scroll events. Both are built with a closure that holds a timer or a timestamp.
IntermediateIn-depthCoding3 min read - How can awaiting inside a loop make code slow, and how do you run async tasks in parallel?
Each await pauses until that task finishes, so awaiting one after another runs them in sequence. Start all the promises first and await them together with Promise.all to run them in parallel.
IntermediateQuick answer1 min read