The code I have is correct, I'm just curious if there is a shorter way to do this?
I think a filter would be the best method but I'm not so sure how to use it.
function tallEnoughToRide(group) {
var result = [];
for (var i = 0; i < group.length; i++) {
if (group[i].heightInInches >= 48) {
result.push(group[i].name);
}
}
return result; //should return a list of people taller than 48 inches
}
var groupA = [{
name: "Mia",
age: 10,
heightInInches: 52
},
{
name: "Jaya",
age: 9,
heightInInches: 45
},
{
name: "Kiana",
age: 10,
heightInInches: 55
},
{
name: "Alex",
age: 11,
heightInInches: 48
}
];
console.log(tallEnoughToRide(groupA));