From 0ee2d9875ac2f40af3ac8c47e26dd4f513204f0c Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Thu, 12 Sep 2024 19:30:52 -0700 Subject: [PATCH] Simplify debounce function No need to pass `this` because it's not being called on an object. --- script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script.js b/script.js index c5f1e1b..306ad52 100644 --- a/script.js +++ b/script.js @@ -65,7 +65,7 @@ function debounce(fn, wait) { let timeoutId; return (...args) => { clearTimeout(timeoutId); - timeoutId = setTimeout(() => fn.apply(this, args), wait); + timeoutId = setTimeout(() => fn(...args), wait); } } -- 2.47.3