Can anyone please tell me what is wrong with my code? I have been sitting here for a few hours trying to figure out why I can’t pass.
function lookUpProfile(name, prop){
// Only change code below this line
for (var i = 0; i < contacts.length; i++) {
if ((name == contacts.firstName) && (contacts[i].hasOwnProperty(prop) == true)) {
return contacts[i][prop];
} else if (name != contacts.firstName) {
return "No such contact";
} else if (contacts[i].hasOwnProperty(prop) == false) {
return "No such property";
}
}
// Only change code above this line
}