Lookup Challenge
"Get a hint" on freecodecamp is down (error 500 - internal server error), so I found this github page.
Unfortunately the solution given does not work / is not accepted by fcc, but this does
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 {
return "No such property";
}
}
}
return "No such contact";
// Only change code above this line
}
I think .some() is not known to beginners at that point.