Hey guys, I’ve been coding now for the past week everyday and I’m exhausted! I’ve been stuck on this question for a while now and I can’t see the problem in my logic, could someone look over it and point it out to me please?That would help me out heaps.
I’m done for a few hours, can’t look at the screen anymore…
Thanks FCC community
out!
function lookUpProfile(firstName, prop){
// Only change code below this line
for (var i = 0; i < contacts.length; i++) {
if (firstName === contacts[i].firstName && contacts[i].hasOwnProperty(prop)){
return contacts[i][prop];
}
else if (firstName !== contacts[i].firstName) {
return "No such contact";
}
else {
return "No such property";
}
}
// Only change code above this line
}
// Change these values to test your function
lookUpProfile("Kristian", "lastName");