Profile lookup - getting no where fast

Profile lookup - getting no where fast
0.0 0

#1

Okay. I’m trying to figure this out. My code returns okay for no such contact but it misses everything else.
function lookUpProfile(firstName, prop){

for (var x = 0; x < contacts.length; x++) {
if (contacts[x] == firstName) {
if (contacts[x].hasOwnProperty(prop)) {
return prop;
} // second if bracket
else {
return “No such property”;
} // else bracket

         } // first if bracket
    else {
      return "No such contact";
      
    } 
         } // for bracket

// Only change code above this line
} // function bracket

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


#2

I’ll give you a hint:

What are you checking in first if statement? What is contacts[i]?