Lookup Profile 3 out of 6

function lookUpProfile(name, prop){

// Only change code below this line

for (var i = 0; i < contacts.length; i++) {

if (contacts[i].firstName === name && contacts[i].hasOwnProperty(prop) !== true) {

return "No such property";

}

else if (contacts[i].firstName === name && contacts[i].hasOwnProperty(prop) === true) {

return contacts[i][prop];

}

else if (contacts[i].firstName !== name) {

return "No such contact";

}

I can’t see what is wrong with my code. It doesn’t return prop value when name is matching

Remember that your function stops running as soon as it hits a return statement.