Lodash - understanding the real functionality/use

Hey all

I have problemes understanding what Lodash really is. I have no problems using it, nor making the exercise. But I don’t really understand why I am doing this, or how I could use this in the future.

Following the explanation given, I first assumed Lodash was a library with that could give you extra built in methods. But doing the project, I rather assume it is to help you see errors when you use their methods?

Also, I don’t really understand the syntax: const _ = {};
So everyting we do has to be within this object. Why? Do you have to put al your JS within this object and than remove it after you checked everything with the lodash check functionnality? Because if you would write al you’r code within that object, it stops working.

I think I am misunderstanding this. Can someone try to explain me what Lodash is and does. Please don’t use the standard explanation you find when you google because that is the one I assume I am misunderstanding.

Thank you for your feedback!

Kind regards,

Yannick

Makes it a lot easier to import all methods in one go (by importing the object), rather then having to import each method individually.

I think there are two things which need to be distinguished here:

  1. Lodash can help speed up development of your project because these extra useful functions are available.
  2. codecademy wants to teach you to implement some of these methods yourself by replicating them. I assume as a teaching experience for algorithms/writing re-usable functions

I can understand why these two points look conflicting.

But you are still in a learning process now, so having some understanding how Lodash implements these methods can be useful. Makes usage in real-world projects later easier

Hey

Thank you for your feedback Stetim. So am I understanding correctly than that these exercises do not really explain how to make usage of Lodash? For instance if I would like to use one of the very functional codes of Lodash in my code, I will need to make a script link or something?

That const _ = {}; and module.exports = _; are only for this specific exercises, and that I normally would not use them in my code?

Kr,

Yannick

no, the focus for these exercises is to implement/replicate some of the functionality found in Lodash library. “Normally”, you would import the library and use these function to speed up development.

you could import Lodash, and you could use the functions/methods you just imported.

Or you could write your own functions/methods, that is also a possibility of course.

See, this is why things are confusing. The exercise is doing the exact opposite. Normally, you would import Lodash, so someone else already created (const _ = {};) and exported the object (module.exports = _;). You would merely import Lodash

1 Like

Okay thanks!

Its much clearer like this!

kr,

Yannick

you’re welcome :slight_smile:

but I also understand the exercise, implementing some of these ideas are great for learning.