Plz get me rid out of these ..........help needed immediately

Tell us what’s happening:

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(name, prop){
// Only change code below this line

  for( var i = 0; i < contacts.length; i++ ){
    if(contacts[i].firstName ===firstName) {
      if( contacts[i].hasOwnProperty( prop ) ) {
        return contacts[i][prop];
      } else {
        return "No such property";
      }
    }
  }
  return "No such contact";
};
// Only change code above this line


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

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/profile-lookup

What is firstName here? (the one you are comparing with contacts[i].firstName)
You have neither defined it nor you have firstName in arguments. So, firstName is undefined.

You already have a variable in your function parameters which will help you reach the solution.

See if you can find that variable.

All the best.

function lookUpProfile(name, prop){
// Only change code below this line
for(var i=0; i<contacts.length; i++)
{
if(contacts[i].name == name){
if(contacts[i].hasOwnProperty(prop)){
return contact[i][prop];}
else{return “No such property”;}

}

now see the code … is it going well… but tick just 2

But the property you’re looking for ISN’T contacts[i].name, so it’ll never match. You want to combine your two blocks o code – you want to see if contacts[i].firstName matches name. The first is the property of the contacts array’s current member, and you want to see if that matches the passed parameter.

Also, when you finally DO get that to match, you’re going to get an error when you return contact[i][prop]; My Magic 8-Ball tells me so.