Hints and tips

There are two excellent libraries to work with collections in a functional fashion in JavaScript: Underscore.js and Lo-Dash. Used in combination with TypeScript or Traceur, they have a very pleasant syntax and provide immense power.

For instance, finding all the members of a collection that satisfy a condition using Underscore.js looks like this:

_.filter(collection, (item) =>item.Id> 3);

This code will find all the items where the ID is greater than 3.

One of these libraries is one of the first things I add to a new project. Underscore.js is actually bundled with Backbone.js, an model-view framework.

Tasks for Grunt and Gulp exist to compile code written in TypeScript or Traceur. There is, of course, also good support for TypeScript ...

Get Mastering JavaScript Design Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.