What are the differences between lodash and underscore?

lodash and underscore are both utility libraries that make JavaScript easier by providing utils that make working with arrays, numbers, objects, strings, etc. much easier. These libraries are great for −

  • Iterating arrays, objects, & strings

  • Manipulating & testing values

  • Creating composite functions

They are both functional libraries. Lo-Dash is a fork of Underscore, and still follows Underscore’s API enough to allow it to serve as a drop-in replacement. But under the hood, it’s been completely rewritten, and it’s also added a number of features and functions that Underscore does not provide.

Lo-Dash was created to provide more consistent cross-environment iteration support for arrays, strings, objects, and argument objects. It has since become a superset of Underscore providing extra features (like AMD support, deep clone, and deep merge), better overall performance and optimizations for large arrays/object iteration, and more flexibility with custom builds and template pre-compilation utilities.