Sorry to bring this one up again. I did review other threads that already went through the issues >>> link. But when I tried these solutions, I was still having the same issues (breaking one half of the test cases or the other half).
My code is pasted below. You can see the very last line is commented out. When I comment it out, the positive testcases work and when I put it in, only THAT testcase works. I think I am overwriting previous testcases (and hence the commenting out fixes them) but I can’t tell how to change the code to fix. Esp since My code seems to follow what is generally being said in this thread >>> link:
function lookUpProfile(firstName, prop){
// Only change code below this line
var message = "";
for (var i = 0; i < contacts.length; i++){
console.log(i + firstName + prop);
if (contacts[i].firstName===firstName){
console.log("First names are matching");
if (contacts[i].hasOwnProperty(prop)){
console.log("This property exists!");
message = contacts[i][prop];
return message;
}else
console.log("This prop does not exist");
message = "No such property";
return message;
}else
message = "No such contact";
// return message;
}
// Only change code above this line
}