Why Underscore.js ?
Installation Process: We can use Underscore.js directly inside the browser and also with node.js. We will discuss both of these methods.
Method 1: Use directly inside the browser.
Visit the official website (https://underscorejs.org/) and download the latest underscore-min.js file UMD available. After that include the following CDN link inside your code in order to run the underscore.js code inside the browser.
npm install underscore
You can also install with yarn
yarn install underscore
Now let’s understand the working of code through an example.
Example: In this example, we will simply see how to find the maximum element from the array list passed. For this, we will use _.max() Function.
Features of Underscore:
- Perform common operations of data like arrays, objects, JSON files, etc.
- Compatible with other JS libraries like jQuery to perform DOM operations.
- Contains function for data manipulation.
Learn more about Underscore.js:
- Collections Complete Reference
- Array Complete Reference
- Functions Complete Reference
- Objects Complete Reference
- Utility Complete Reference
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above