angular 10 find in array code example
Example 1: find typescript
const inventory = [
{name: 'apples', quantity: 2},
{name: 'bananas', quantity: 0},
{name: 'cherries', quantity: 5}
];
function findCherries(fruit) {
return fruit.name === 'cherries';
}
inventory.find(findCherries);
inventory.filter(x => x.name === 'bananas')[0];
inventory.find(e => e.name === 'apples');
Example 2: how to find element in array angularjs
$filter('filter')(myArray, {'id':73})
Example 3: how to find element in array angularjs
comment by pritesh