Sometimes, we want to fix Lodash debounce not working in anonymous function with JavaScript.
In this article, we’ll look at how to fix Lodash debounce not working in anonymous function with JavaScript.
How to fix Lodash debounce not working in anonymous function with JavaScript?
To fix Lodash debounce not working in anonymous function with JavaScript, we call the function that debounce
returns.
For instance, we write
_.debounce(debounceIt, 500, false)();
to call debounce
with the debounceIt
and the debounce interval to return a debounced function.
Then we call it immediately with ()
at the end.
Conclusion
To fix Lodash debounce not working in anonymous function with JavaScript, we call the function that debounce
returns.