How to use Underscore JS in Node JS App?

About Us:

We are from free coder. We are a group of web developers who are passionate about web development. You can learn from us php, laravel, node js, vue js, react js and many other topic on web developement.
we are very happy to help you.
free coder

Today what you are going to learn:

Hello Brother, i will show you node js underscore lesson. We will use underscore js sort array of objects node js. i explained simply about underscore js in node js. Here you will learn how to use underscore js in node js.

Underscore is a JavaScript library that provides a whole mess of useful functional programming helpers without extending any built-in objects. underscore js provide lots of array objects helper function that way you can easily work with array. it provides helper function like sortBy, each, map, find, filter, max, min, groupBy etc.

i given very simple lesson bellow:


Install Underscore:

npm install underscore


var _ = require('underscore');

objs = [

{ name:'Paresh', age: 32, email: ''},

{ name:'Sagor', age: 30, email: ''},

{ name:'Ankit', age: 60, email: ''},


var newObjName = _.sortBy(objs, 'name');


var newObjAge = _.sortBy(objs, 'age');




{ name: 'Ankit', age: 60, email: '' },

{ name: 'Sagor', age: 30, email: '' },

{ name: 'Paresh', age: 32, email: '' }



{ name: 'Sagor', age: 30, email: '' },

{ name: 'Paresh', age: 32, email: '' },

{ name: 'Ankit', age: 60, email: '' }


thank you very much for following up with me.


Recent Posts

Related Posts