Hi all, I am running on a problem with profile lookup challenge.
Can someone explain why I wrong?
Here is my code:
function lookUpProfile(name, prop){
// Only change code below this line
for (var i = 0 ; i < contacts.length; i++) {
if (name === contacts[i].firstName) {
if (contacts[i].hasOwnProperty(prop) === true) {
return contacts[i][prop];
}
else return "No such property";
}
else
{
return "No such contact";
}
}
// Only change code above this line
}
Thank you very much.