Profile Lookup Topic

Hello
I`m getting errors on Profile Lookup exersice. Here-s my code:

// Setup

const 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 (let x = 0; x < contacts.length; x++) {

   if (contacts[x].firstname === name) {

     return contacts[x][prop] || "no such property";

   }

  }

  return "no such contact";

  // Only change code above this line

}

lookUpProfile("Akira", "likes");

HI @Edgar29 !

These are technically incorrect.

Casing matters.

Reread the directions and make sure you are returning the correct strings.

Hope that helps!

You also have a casing issue here

Take a close look at the property name and you will see that it uses camel casing .

1 Like

Thank you very much. I have fixed casing issues and it workes now.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.