Trying To Figure Out Josh W. Comeau's Debouncer In An Event Listener
TL;DR
I'm using Josh's debouncer script snippet. I've got it working using a `const doUpdate1 = debounce((event) => {}, 100)approach, but can't figure out how to do it if the function is defined with `function
.
Details
Josh's script looks like this:
JavaScript
Given these two buttons:
HTML
Clicker 1
Clicker 2
Output
This is breaking my understanding of javascript a little. I thought using `returnin `doUpdate2
would produce the same result.
I'm not sure what's going on here. I'm over on Mastodon if you've got suggestions.
-- end of line --