Filtering

There might be some items in a list, as well as in a stream, that you do not want. What you do to fix that is to create a filter that filters out the unwanted data. Modeling our initial array, the manipulation, and the resulting array, we get the following: 

In JavaScript, we can accomplish this by writing the following code:

let array = [1,2,3];let filtered = array.filter(data => data % 2 === 0);

Get Architecting Angular Applications with Redux, RxJS, and NgRx 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.