Profile Lookup of contacts

Tell us what’s happening:
got 3 out of 5 objective anyone please help out

Your code so far

//Setup
var contacts = [
    {
        "firstName": "Akira",
        "lastName": "Laine",
        "number": "0543236543",
        "likes": ["Pizza", "Coding", "Brownie Points"]
    },
    {
        "firstName": "Harry",
        "lastName": "Potter",
        "number": "0994372684",
        "likes": ["Hogwarts", "Magic", "Hagrid"]
    },
    {
        "firstName": "Sherlock",
        "lastName": "Holmes",
        "number": "0487345643",
        "likes": ["Intriguing Cases", "Violin"]
    },
    {
        "firstName": "Kristian",
        "lastName": "Vos",
        "number": "unknown",
        "likes": ["Javascript", "Gaming", "Foxes"]
    }
];


function lookUpProfile(firstName, prop){
// Only change code below this line
var value;
  for (var c = 0; c < contacts.length; c++){
    if ((contacts[c].firstName === firstName) && (contacts[c].hasOwnProperty(prop))) {
      value = contacts[c][prop];
      break;
    }
    if (contacts[c].hasOwnProperty(firstName) === false) {
      value = "No such Contact";
    }
    if (contacts[c].hasOwnProperty(prop) === false) {
      value = "No such Property";
    }
  }
return value;
// Only change code above this line
}

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

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.89 Safari/537.36.

Link to the challenge:
https://www.freecodecamp.org/challenges/profile-lookup

What do the failing tests say? Where do you think your problem might be? How is the code behaving differently than you expect? What have you tried already?

In both of the following lines, you have a a slight typo. Remember that JavaScript is case sensitive. Look carefully at the the challenge instructions for what values to return for these two conditions.

value = "No such Contact";

and

value = "No such Property";
1 Like