Hello everyone,
I will be very thankful if someone explained to me what I’m doing wrong here! I am struggling to find what’s wrong here
Your code so far
function lookUpProfile(name, prop){
var i = 0;
for (i = 0; i < contacts.length; i++) {
if (name !== contacts[i].firstName) {
return "No such contact";
} else if (!(contacts[i].hasOwnProperty(prop))) {
return "No such property";
} else {
return contacts[i].prop;
}
}
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/profile-lookup/