I am working with an Angular 2 Ionic app -
Is there a way I can filter all persons by age in my personsArr and then find if any key in my personObj matches a personArr name and return a boolean?
I have an example array like:
personsArr = [{
"name": "Ram",
"email": "[email protected]",
"age": 23
},
{
"name": "peter",
"email": "[email protected]",
"age": 23
},
{
"name": "John",
"email": "[email protected]",
"age": 33
},
{
"name": "Bob",
"email": "[email protected]",
"age": 41
}
]
and an object like this
personObj = {
"peter": "helper",
"Ram": "helper",
"Bob": "helper"
}
How can I filter personsArr by age and then check if any key from personObj matches person name?
Pretty sure I can just do this with a loop, but is there a better way?
Appreciate any help or advise.