angular array find code example
Example 1: javascript array.find
const array1 = [5, 12, 8, 130, 44];
const found = array1.find(element => element > 10);
console.log(found);
Example 2: array find
const array1 = [5, 12, 8, 130, 44];
const found = array1.find(element => element > 10);
console.log(found);
Example 3: return object list in find js
const inventory = [
{name: 'apples', quantity: 2},
{name: 'bananas', quantity: 0},
{name: 'cherries', quantity: 5}
];
function isCherries(fruit) {
return fruit.name === 'cherries' && fruit.name === 'bananas';
}
console.log(inventory.find(isCherries));
Example 4: how to find element in array angularjs
$filter('filter')(myArray, {'id':73})
Example 5: how to find element in array angularjs
comment by pritesh