O'Reilly logo

Learning Underscore.js by Alex Pop

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Searching and filtering

In the previous chapter, we used the function _.find(list, predicate, [context]) to search for a specific item within a collection. This function is part of the Underscore comprehensive functionality for searching and filtering collections represented by object properties and array-like objects. We will make a distinction between search and filter functions with the former tasked with finding one item in a collection and the latter tasked with retrieving a subset of the collection (although sometimes, you will find the distinction between these functions thin and blurry).

We will revisit the find function and the other search-related and filtering-related functions using an example with slightly more diverse data that is ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required