Code
Loading editor...
Tap Analyze to see visualization
Click Analyze to visualize
See step-by-step execution, variables, and output
Variables
Run code to see variables
Output
Console output will appear here
Click Analyze to visualize
See step-by-step execution, variables, and output
Run code to see variables
Console output will appear here
Return a wrapper function that resets a timer on every call using clearTimeout and setTimeout. The original function only executes after the caller stops invoking for the specified wait period. Use apply to preserve the correct this context and arguments.
Each invocation clears the previous timer and starts a new one, so only the last call in a burst of rapid calls actually triggers the function after the wait period elapses.
Updated Mar 2026