APPLYING FILTER IN TYPESCRIPT code example

Example 1: how to use filter in typescript

var numbers = [1, 3, 6, 8, 11];

var lucky = numbers.filter(function(number) {
  return number > 7;
});

// [ 8, 11 ]

Example 2: typescript filter list by property

const object = {
  firstAttribute: 'firstValue',
  secondAttribute: 'secondValue'
};  

objectList.filter(o -> o.firstAttribute === 'firstValue');

Example 3: filter typescript

this.booksByStoreID = this.books.filter(book => book.store_id === this.store.id);