我正在object
从 Facebook 获取数据,并希望选择所有子值为 xxx 的objects
。array
(object
当然是简化的)的结构如下:
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"
}
]
}
]
假设我想用education.type = "Highscool" 获取所有对象。我怎样才能做到这一点,而不循环整个对象......?