Debounce
setTimeout
www.scribbler.live
What is setTimeout?
setTimeout executes a function once
after a specified delay.
Example
What is Debounce?
Debounce ensures a function executes
only after a period of inactivity.
Example
A search input field that makes API
calls only after typing stops.
debounce setTimeout
Purpose
Delays execution Delays execution
until after inactivity once
Repeated
Calls
Clears previous timer Each call creates a
before starting a new timer
new one
Example
Use Cases
Preventing excessive Delaying execution
API calls (e.g., (e.g., hide a message
search inputs) after 5s)
Which One Should You
Use?
when you just need a delay
setTimeout
before running code once.
when you want to prevent
debounce
frequent function execution.
Keep Exploring
Javascript
with us!
Share this with a friend who needs it and
make sure to practice these in scribbler.
Scribbler.live
Free and Open Interface to
experiment JavaScript