What is Lodash?
Lodash is a JavaScript library that works on the top of underscore.js. It helps in working with arrays, strings, objects, numbers, etc. It provides us with various inbuilt functions and uses a functional programming approach which that coding in JavaScript easier to understand because instead of writing repetitive functions, tasks can be accomplished with a single line of code. It also makes it easier to work with objects in JavaScript if they require a lot of manipulation to be done on them.
 Lodash Tutorial
Why Lodash?
It provides various inbuilt functions for collections, arrays, manipulated objects, and other utility methods that we can use directly instead of writing them from scratch. It makes it easier to iterate over the arrays, strings as well as objects. Its modular methods make the creation of composite functions easier.
What is Lodash npm ?
The Lodash npm is used to install and import Lodash library using npm module. The command for installation of Lodash using npm module is npm i lodash
How to Install Lodash ?
Lodash library can be used directly using the CDN link or can be installed using npm or yarn.
Using CDN Link
We can directly use the file in the browser. Go to the official documentation and copy the lodash.min.js file CDN link and paste this link inside the head section.
<script type=”text/JavaScript” src = “https://cdn.jsdelivr.net/npm/[email protected]/lodash.min.js”></script>
Installation using npm
We can install Lodash with npm. Make sure that you have Node.js and npm installed.
npm install lodash
If you are using yarn then you can use the following command:
yarn install lodash
Now in order to use the Lodash library, you need to require it in the code file.
const _ = require("lodash");
Now let’s understand how to use Lodash with the help of the code example.
Learn more about Lodash
Lodash Array Methods
Lodash Collection Methods
Lodash Functions
Lodash Lang Methods
Lodash Math Methods
Lodash Object Methods
Lodash Seq Methods
Lodash String Methods
Lodash Util Methods
|