Hi.
I already saw the solution and understand it. I just don’t understand why my code doesn’t work.
The only problem is when it doesn’t have the property.
function lookUpProfile(name, prop){
// Only change code below this line
for(var i = 0; i < contacts.length; i++) {
if(name === contacts[i].firstName && contacts[i].hasOwnProperty(prop)) {
return contacts[i][prop];
} else if(name === contacts[i].firtName && contacts[i].hasOwnProperty(prop) === false) {
return "No such property";
}
}
return "No such contact";
// Only change code above this line
}