Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Underscore.js

In Chapter 5, I briefly pointed out a library named prelude.ls that provides a number of functions that allow you to write web-centric, client-side code with a more functional style. Underscore.js was written by the same person who created CoffeeScript and it has a similar goal as prelude.ls, but with more features (not all of which are specifically targeted at a functional style).

The Underscore.js site contains a large number of examples, so I will only provide a quick, high-level list of features:

  • Collection-related functions include map, reduce, filter, all, any, sortBy, and groupBy.

  • Array-related functions include first, last, union, intersect, flatten, and zip.

  • Helper functions include bind, memoize, throttle, and once.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint