find an element in array typescript code example
Example 1: typescript array find
const array1 = [5, 12, 8, 130, 44];
const found = array1.find(element => element > 10);
console.log(found);
// expected output: 12
Example 2: find value in array ts
this.persons = this.personService.getPersons().find(x => x.id == this.personId);