I'm getting data from an object from Facebook, and would like to select all objects in an array, that has a child value of xxx.
The object (simplified of course) is structured like this:
var friends = [
{
id: 123456,
name: "Friend1 name",
education: [
{
school: {
name: "School1 name"
},
type: "Highscool"
}
]
},
{
id: 3456789,
name: "Friend2 name",
education: [
{
school: {
name: "School2 name"
},
type: "College"
}
]
}
]
Let's assume that I want to get all objects with education.type = "Highscool". How can I do this, without looping though the entire object...?
educationhave? Should we check only the first oneeducation[0]?"Highscool"is a typo. :-) I used"Highschool"in my answer, but adjust as necessary.