typescript filter in 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;
});
Example 2: .filter js
const words = ['spray', 'limit', 'elite', 'exuberant', 'destruction', 'present'];
const result = words.filter(word => word.length > 6);
console.log(result);
Example 3: typescript filter list by property
const object = {
firstAttribute: 'firstValue',
secondAttribute: 'secondValue'
};
objectList.filter(o -> o.firstAttribute === 'firstValue');