How to use the lodash NPM package in Node.js?

suparman21 asked this question 1 year, 4 months ago
suparman21 on Jan 20, 2022

How do I use the lodash NPM package?

I see that many people use the _ underscore to call lodash methods. How do you configure your code to do that?

2 suggested answers
moon_man41 on Jan 21, 2022

Install it to your project's dependencies:

npm install --save lodash

Then, require() it at the top of your project:

const _ = require("lodash")

After that, you can use it in your code:

0 replies
nick on Jan 21, 2022

Just require() it and put it to use:

const _ = require("lodash")
0 replies