We are working hard to bring coding challenges with editor on mobile 💚
Debounce Input
Objective: Implement an input field with a debounced event handler to optimize performance.
Instructions:
Create an input field where user input is handled after a specified delay (debounced) to prevent unnecessary function calls (e.g., when searching or filtering data).
The event handler should only trigger after the user has stopped typing for a certain period (e.g., 500 milliseconds).
The input value should be displayed or logged after the debounce delay.
Requirements:
Implement a debounce mechanism to delay the input handling.
The input value should only update once the debounce delay has passed without additional input.
Hints:
You can use setTimeout and clearTimeout to manage the debounce logic.