Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"_.debounce is not a function" when using lodash 4.11.1

I'm completely new to lodash, but I'm trying to implement debounce as per this article. I can get it using v3.5 via this CDN but every time I try to download 4.11.1 and include it in my project I get an Uncaught Type Error: _.debounce is not a function.

Here's my script, pretty straightforward:

jQuery(window).on("resize", _.debounce(function() {
    console.log("hello world");
}, 400));

Any ideas why this wouldn't be working with the newer version of lodash? I referenced the documentation and I'm not seeing anything out of place here. Very odd.

like image 668
JacobTheDev Avatar asked Feb 26 '26 05:02

JacobTheDev


1 Answers

Okay, I feel dumb about this. I completely missed that there where two separate builds, "core" and "full." Apparently core doesn't come bundled with debounce. I've got it working now with the full script.

like image 162
JacobTheDev Avatar answered Feb 28 '26 19:02

JacobTheDev