Open In App

Underscore.js Introduction

Improve
Improve
Like Article
Like
Save
Share
Report

Underscore.js is a lightweight JavaScript library and not a complete framework that was written by Jeremy Ashkenas that provides utility functions for a variety of use cases in our day to day common programming tasks. 

With just under six kilobytes in size, this library basically provides us with a whole bunch of useful JavaScript functions for making our life easier, there are literally hundreds of different functions available that support both our workaday functional helpers such as the map and filter functions, as well as more specialized ones such as JavaScript templating, function binding, deep equality testing, creating quick indexes, and many more. 

Underscore functions basically falls under four major categories which are functions that can be used for manipulating arrays, functions that can be used for manipulating objects, functions that can be used for manipulating both arrays as well as objects and functions that can be used for manipulating other functions itself. 

Features of Underscore: 
 

  • Perform common operations of data like arrays, objects, JSON files etc.
  • Compatible with other JS libraries like jQuery to perform DOM operation.
  • Contains function for data manipulation.

Kinds of Data Operation: 
 

  • Fetch Data from Collection.
  • Transform Data in various formats.
  • Sort, Filter and Group Data.
  • Convert Data into Required result by performing specific operation on them.
  • Templates can be used to perform data operations.

Installation: 
 

  • Node.js: 
     
npm install underscore
  • Meteor.js: 
     
meteor add underscore
  • Require.js: 
     
require(["underscore"], ...
  • Bower: 
     
bower install underscore
  • ExtendScript: 
     
#include "underscore.js"

 


Last Updated : 29 Nov, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads