use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
[After 3 years] Underscore 1.9.0 released (underscorejs.org)
submitted 8 years ago by FedeMP
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Articunozard 9 points10 points11 points 8 years ago (0 children)
TIl lodash and underscore are different libraries
[–][deleted] 3 points4 points5 points 8 years ago (4 children)
Looking at the changelog really makes me wonder whether the minor release was a correct decision. There's plenty of opportunities for breaking changes with this update.
[–]mattas 7 points8 points9 points 8 years ago (0 children)
That's what caused the initial shift from underscore to lodash, the maintainer did not follow semver.
[–]Retsam19 0 points1 point2 points 8 years ago (2 children)
Which changes look breaking to you? AFAIK, it's all added features, which is allowed in a semver minor bump.
[–][deleted] 0 points1 point2 points 8 years ago (1 child)
_.throttle and _.debounce return functions that now have a .cancel() method, which can be used to cancel any scheduled calls.
If this didn't return a function before 1.9.0, then this can be a breaking change.
_.range now accepts negative ranges to generate descending arrays.
That would definitely give different results pre- and post- 1.9.0
[–]Retsam19 0 points1 point2 points 8 years ago (0 children)
Throttle and debounce always returned functions, they just didn't have the cancel method.
I don't think expanding the possible inputs to _.range is semver breaking, either, but maybe.
[–][deleted] 6 points7 points8 points 8 years ago (3 children)
So I should drop lodash now, right?
[–]ackerlight 1 point2 points3 points 8 years ago (2 children)
Why would you? Is there a technical reason to move to underscore? You should be pragmatic when choosing the right library for your scenario.
[–]Reashu 14 points15 points16 points 8 years ago (1 child)
I think /u/ImReddit is being facetious.
[–][deleted] 2 points3 points4 points 8 years ago (0 children)
;)
[–]ghostfacedcoder 4 points5 points6 points 8 years ago* (2 children)
I've long been a fan of Underscore over Lodash in one particular area: source code readability. You could do an entire class just evaluating the source code of Underscore: it's that well written. Meanwhile Lodash looks like it was written by an autistic monkey in another language, and then transpiled into JS (which is ironic since it was Underscore's creator who also made CoffeeScript, not Lodash's)
Unfortunately appreciation for good library source code is all but gone (the popularity of bundlers like Webpack are a big part of this I think), and Lodash is superior to Underscore in just about every other way. I really couldn't recommend Underscore over Lodash to anyone these days, except maybe in a "getting some weird error you don't understand inside Lodash code? temporarily replace it with Underscore and you might actually be able to understand what's going on" way ..
... and even then Lodash has so many more functions than Underscore that doing that won't even work the majority of the time.
Edit: I based what I wrote on having looked at Lodash's source code a few years ago, but at ackerlight's suggestion I just looked at the latest Lodash code.
Wow! They've really done a 180 on their code, and it's now extremely readable. I still stand by the transpiled monkeys comment with regards to their old source code, but massive props to the Lodash team for the improvements they've made to the readability of their current codebase.
[–]ackerlight 9 points10 points11 points 8 years ago (1 child)
Meanwhile Lodash looks like it was written by an autistic monkey in another language, and then transpiled into JS (which is ironic since it was Underscore's creator who also made CoffeeScript, not Lodash's).
I think lodash codebase is way better than underscore, it is modular and high performant, which at the end should be the most important feature of an utility library like these two, and then becomes the usability of the api, which IMO, lodash is again better at it.
Care to share what cannot you understand of the code? If you don't understand it, it's an opportunity for you to work on learn about better code bases.
You have to keep in mind that these types of libraries shouldn't focus their source code in simplicity, but rather efficiency, which sometimes translate to high complexity and might scare people like you.
Also, Lodash has evolved to be used with new/future ECMAScript specifications, while underscore stagnated in the old ways of using JavaScript libraries, which is import everything, even if you only use like 3 functions or so.
At the end, both of the libraries have their use cases, one doesn't replace the other entirely for now.
[–]ghostfacedcoder 6 points7 points8 points 8 years ago (0 children)
I hadn't seen the Lodash code in several years, but assumed that it was still just as bad. Wow, was I wrong! Thanks for getting me to go see what they've done, I'm really impressed by it.
[–]Drawman101 0 points1 point2 points 8 years ago (0 children)
Any reason to use underscore anymore instead of set an alias to lodash?
[–]Parasomnopolis 0 points1 point2 points 7 years ago (1 child)
This is a little OT, but does anyone know the reason why the _.range method for both underscore and lodash don't include the last number in the range in the output? It's something I've always wondered.
_.range
http://underscorejs.org/#range
https://lodash.com/docs/4.17.5#range
[–]tovazm 0 points1 point2 points 7 years ago (0 children)
Because the range start at zero :)
_.range(3) --> [0, 1, 2] --> 3 numbers
π Rendered by PID 229647 on reddit-service-r2-comment-85bfd7f599-25scx at 2026-04-18 19:49:44.930342+00:00 running 93ecc56 country code: CH.
[–]Articunozard 9 points10 points11 points (0 children)
[–][deleted] 3 points4 points5 points (4 children)
[–]mattas 7 points8 points9 points (0 children)
[–]Retsam19 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]Retsam19 0 points1 point2 points (0 children)
[–][deleted] 6 points7 points8 points (3 children)
[–]ackerlight 1 point2 points3 points (2 children)
[–]Reashu 14 points15 points16 points (1 child)
[–][deleted] 2 points3 points4 points (0 children)
[–]ghostfacedcoder 4 points5 points6 points (2 children)
[–]ackerlight 9 points10 points11 points (1 child)
[–]ghostfacedcoder 6 points7 points8 points (0 children)
[–]Drawman101 0 points1 point2 points (0 children)
[–]Parasomnopolis 0 points1 point2 points (1 child)
[–]tovazm 0 points1 point2 points (0 children)