16

young user @Mizukuro asked days ago for ways to improving his javascript skills.

I wasn't sure what to say at the moment, but then I thought of something.

Lodash is the most depended upon package in npm. 90k packages depend on it, more than double than the second most depended upon package (request with 40k).

Lodash was also created 6 years ago.

This means lodash has been heavily tested, and is production ready.

This means that reading and understanding its code will be very educational.

Also, every lodash function lives in its own file, and are usually very short.

This means it's also easy to understand the code.

You could start with one of the "is..." (eg isArray, isFunction).

The reason for such choice is that it's very easy to understand what these functions do from their name alone.

And you also get to see how a good coder deals with js types (which can be very impredictible sometines).

And to learn even more, read the test file for that function (located in tests/<original file name>.js. For the most part they are very readable and examples of very good testing code.

Here's the isFunction code
https://github.com/lodash/lodash/...

Here's the test for isFunction
https://github.com/lodash/lodash/...

The one thing you won't learn here is about es5, 6, or whatever.

Comments
Add Comment