Currently tackling Free Code Camp's Javascript tutorials and encountering a roadblock on the "Contact Profile" Seems like I need to ensure that the iteration completes before moving on, but struggling with syntax and order. Any insights?
function lookUpProfile(firstName, prop){
// Only change code below this line
for(var i = 0; i < contacts.length; i++){
if(contacts[i].firstName === firstName){
if(contacts[i].hasOwnProperty(prop)){
}
return contacts[i][prop];
}
else if (contacts[i][firstName] !== firstName){
return "No such contact";
}
else if (contacts[i].hasOwnProperty(prop) === undefined){
return "No such property";
}
}