Why my && doesn’t work on my code, if you just put this code (contacts[i].hasOwnProperty(prop)) in a separate if the hole code will be working, so what the problem here ?
thx by the way.
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 {
return "No such property";
}
}
return "No such contact";
// Only change code above this line
}