Profile Lookup challenge

Profile Lookup challenge
0.0 0


Hi all! I don’t understand why the last condition (else statement) don’t perform.

function lookUpProfile(firstName, prop){
// Only change code below this line
var i = 0;
while(contacts[i]) {
if (contacts[i].firstName === firstName && contacts[i].hasOwnProperty(prop)) {
return contacts[i][prop];

if (!contacts.firstName) {
return “No such contact”;
else {
return “No such property”;

// Only change code above this line

// Change these values to test your function
lookUpProfile(“Akira”, “address”);

It return “No such contact” although should return “No such property”.

Thans a lot for help