The bind
and bindAll
functions are just the tip of the iceberg of what Underscore has to offer web developers. While a full explanation of everything that Underscore has to offer is outside the scope of this book, it is worth taking a few moments to examine a few of Underscore's most useful functions. If you want to learn more about Underscore beyond what we have covered in this chapter, I strongly recommend that you read its web page (http://underscorejs.org/), which has well-written documentation for every method in the library.
Every JavaScript developer knows how to iterate using the for
loops, but Underscore provides three powerful alternatives to those native loops: each
, map
, and reduce
. While all three of these methods (along with many of the other Underscore methods) are included natively in ES5-supporting browsers, older browsers, unfortunately, do not have support for them. These alternative loops are so convenient that you may find yourself...