Can anyone help understand why the following function is not working when resolving the profile lookup challenge
function lookUpProfile(name, prop){
// Only change code below this line
for (var i=0; i<contacts.length;i++){
if(name===contacts[i].firstName && contacts.hasOwnProperty(prop) ){
return contacts[i][prop];
}
else if(name!==contacts[i].firstName){
return "No such Contact" ;
}
else{
return"No such Property";
}
}
// Only change code above this line
}
console.log(lookUpProfile("Akira", "lastName"));