function lookUpProfile(name, prop){
// Only change code below this line
for (var i = 0; i < contacts.length; i++) {
if (contacts[i].firstName === name && contacts[i].hasOwnProperty(prop) !== true) {
return "No such property";
}
else if (contacts[i].firstName === name && contacts[i].hasOwnProperty(prop) === true) {
return contacts[i][prop];
}
else if (contacts[i].firstName !== name) {
return "No such contact";
}
I can’t see what is wrong with my code. It doesn’t return prop value when name is matching