A Cry for Help -_-

I´m sooooooo lost -_- It´s showing that i´m missing semicolon, but I don´t see any missing. Or what did I do wrong?

  **Your code so far**

// 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 (var i = 0, i < contacts.length, i++) {
if (name == contacts[i].firstName) {
  if (contacts[i].hasOwnProperty(prop)) {
  return contacts[i].prop;
  } else {
    return "No such property";
  }
} else {
  return "No such contact";
}
} 
// Only change code above this line
}

console.log(lookUpProfile("Akira", "likes"));
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36

Challenge: Profile Lookup

Link to the challenge:

Hey, looks like you used commas inside your for loop where you needed the semicolons. While I believe in fishing lessons, I believe you merely requested a second set of eyes. :wink:

ps/hint: remember… you want to make sure you’ve looped/checked all your contacts before you return a ‘No such contact’

2 Likes

Thank you. It looks like too long looking at the code made me not just frustrated , bud blind too :grinning:

2 Likes

Sometimes it really does help to walk away from your code for a little and return with a fresh mind! I’ve had to practice this numerous times myself. Glad you found the issue and the solution.

2 Likes

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