Someone tell what’s wrong with this code and a fix to it? Thanks!
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]["firstName"]) {
return "No such contact";
} else if(prop !== contacts[i].hasOwnProperty(prop)) {
return "No such property";
}
}
}