Enter Your Email Address to Watch This Lesson

Your link to unlock this lesson will be sent to this email address.

Unlock this lesson and all 962 of the free egghead.io lessons, plus get JavaScript content delivered directly to your inbox!



Existing egghead members will not see this. Sign in.

Introduction to Lodash

1:33 JavaScript lesson by

Lodash Breaking Changes

Be aware that this lesson covers Lodash version 2.x and the current version is >4.x. The API has changed slightly. Please refer to the documentation!

Lodash is a toolkit of Javascript functions that provides clean, performant methods for manipulating objects and collections. It is a "fork" of the Underscore library and provides additional functionality as well as some serious performance improvements. If you aren't using Lodash, you should be.

Get the Code Now
click to level up

Lodash Breaking Changes

Be aware that this lesson covers Lodash version 2.x and the current version is >4.x. The API has changed slightly. Please refer to the documentation!

egghead.io comment guidelines

Avatar
egghead.io

Lodash is a toolkit of Javascript functions that provides clean, performant methods for manipulating objects and collections. It is a "fork" of the Underscore library and provides additional functionality as well as some serious performance improvements. If you aren't using Lodash, you should be.

Avatar
Roman Ganchenko

How did you make your WebStorm to behave this way? Like you save a code and it runs instantly in the separate window?
Would love to know about it

In reply to egghead.io
Avatar
John

You can have any node script "Run" when you hit "Ctrl+R". Right-click on the script to set it up the first time, then Ctrl+R for subsequent runs.

In reply to Roman Ganchenko
Avatar
Deryck

I don't like linking off-site, but I think anyone that is either unsure of using lodash vs. underscore (or others), or really any developer with at least an intermediate understanding of JS, needs to watch this video.

John-David Dalton, the Lo-Dash creator, describes how his library is built with optimizations that, in some cases, even outperform some native counterparts: https://www.youtube.com/watch?v=NthmeLEhDDM&list=LLuyw3Di40FSMiYsdksLkKDg

Avatar
Tijmen

I would like to know howto set up webstorm to replicate the environment in which you demo.

I created a new project and did an npm install for lodash. then I create a demo.js and I try to require lodash so I can run the demo js but it doesn't work

In reply to John
Avatar
Tijmen

I had to require the whole relative path. I thought require would look for a node_modules folder itself

In reply to Tijmen
Avatar
Deryck

John does this in a shockingly high number of videos actually.

https://www.youtube.com/playlist?list=PLQ176FUIyIUb0zTe7k4ZKkhMsR-slKu3w
https://www.youtube.com/watch?v=leKbqNpgoNQ
https://egghead.io/lessons/webstorm-tips-tricks

I would like to know howto set up webstorm to replicate the environment in which you demo.

I created a new project and did an npm install for lodash. then I create a demo.js and I try to require lodash so I can run the demo js but it doesn't work

In reply to Tijmen
Avatar

what version of lodash are you using?

In reply to egghead.io

Lo-Dash is an insanely helpful set of utilities for both for the browser and node. Let's say for example I want to get the first three values out of this set of people. I can just say first three, run it, and I can get the first three people.

If I want to sort by their names, I can just say sort by name. You can see now it's sorted by name. If I want it to sort by their age, I can now sort by their age. If I only want to get a new array of just the names and I don't care about the values, I could get that. I could then sort them and get those.

If I only wanted to get the people who are of the age of 22, I could say age 22 and return all those people. Again, do something like a sort. Or if I wanted to get the oldest person, I could say max and check the age and get the oldest person. Or if I get the youngest person, let's say min and age, and on and on and on.

Lo-Dash does have a ton of features. If you want to read about all of them, go their API documentation at Lo-Dash.com/docs. If you're familiar with other libraries like Underscore, which Lo-Dash came from, or something like Sugar JS. These are all very similar but Lo-Dash has seen the greatest adoption in the community due to its performance and features and other things like that.

We'll be doing a lot more videos on Lo-Dash as well as simply using Lo-Dash in videos, because it's such a great library.

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?