Difference between lodash and Underscore

The lodash and UnderScore both are utility libraries from JavaScript which helps make it easier by providing utils which makes, working with arrays, numbers, objects, and strings much easier. They provide a group of tools used for common programming operations having a strong functional programming task.

Lodash: It is a JavaScript utility library that delivers consistency, modularity, and performance to its code. It provides utility functions for the basic programming tasks using the functional programming paradigm. Lodash’s API is a superset of Underscore. It provides every functionality that Underscore does, along with a few additional helpful functions such as AMD support, deep clone, and deep merge. It also provides better overall performance and optimization of larger iterables than underscore.

Underscore: Underscore is a modern JavaScript library that provides a whole mess of useful functional programming helpers without extending any built-in objects. Underscore was created by Jeremy Ashkenas.

Differences between lodash and underscore:

Lodash Underscore
  • Lodash holds first position amongst the most depended on packages according to Node Package Manager(NPM) from javascript.
  • Underscore holds ninth position amongst the most depended on packages according to Node Package Manager(NPM) from javascript.
  • Lodash has improved syntax for chaining functions.
  • Underscore’s chaining syntax are a bit heavy.
  • Lodash is significantly larger than Underscore with a size of 33KB
  • Underscore lies at about 16KB only.
  • Lodash is fast.
  • Underscore is average in speed.
  • Lodash can handle nested objects.
  • Underscore can handle only the base objects
  • Lodash allows cloning and comparing objects that are deeply nested.
  • Underscore does not allow cloning and comparing of nested objects.

Different basic commands of lodash and underscore having same functionality:



It checks if the predicate returns TRUE for any element of the collection.

  • Underscore:._any
  • Lodash:._some

It checks if the predicate returns TRUE for all elements of the collection.

  • Underscore:_.all
  • Lodash:_.every

It creates a function that invokes the given functions from right to left.

  • Underscore:_.compose
  • Lodash:_.flowRight

It looks through the list and returns the first value that matches all of the key-value pairs listed in properties.

  • Underscore:_.findWhere
  • Lodash:_.find

It returns a key for each element in the list and returns an object with an index of each item.

  • Underscore:_.indexBy
  • Lodash:_.keyBy

It calls the method named by method name on each value in the list.

  • Underscore:_.invoke
  • Lodash:_.invokeMap

It transforms the value of each property in turn.

  • Underscore:_.mapObject
  • Lodash:_.mapValues

It returns the index at which value can be found in the array, or -1 if the value is not present in the array.

  • Underscore:_.indexOf
  • Lodash:_.sortedIndexOf

It looks through each value in the list and returns an array of all the values that match the key-value pairs listed in properties.

  • Underscore:_.where
  • Lodash:_.filter

It converts an object into a list of key-value pairs.

  • Underscore:_.pairs
  • Lodash:_.toPairs 

full-stack-img

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.