Book Image

Learning Underscore.js

By : Alexandru Vasile Pop
Book Image

Learning Underscore.js

By: Alexandru Vasile Pop

Overview of this book

Table of Contents (14 chapters)
Learning Underscore.js
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using the lodash library


The lodash library (https://lodash.com) was created as a fork of Underscore, with a focus on better performance, improved consistency across browsers, and enhanced code readability. Currently at version 3, it offers a thorough test suite, excellent documentation, and an extensively customizable build utility. In its previous versions, it even offered an Underscore compatible file so that you can use lodash as a drop-in replacement for Underscore (especially, useful for projects using Backbone.js).

Initially, the main difference between lodash and Underscore was that lodash was not relying on any native JavaScript functions to implement functions such as _.map(), _reduce, and _.forEach(). As discussed in the Underscore and JavaScript standards section, Underscore used the native ES5 functions if available (up until version 1.6). These native functions were slower than the lodash equivalent functions, as they catered to many edge cases and historic JavaScript implementations...