Problem with the Profile Lookup

Tell us what’s happening:

I don’t know what am doing wrong. I tested this code in other environment (vsc and other online consoles) and it works but in the platform won’t work. if some one can help i by happy.

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

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

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:95.0) Gecko/20100101 Firefox/95.0

Challenge: Profile Lookup

Link to the challenge:

Two problems.

  1. Nowhere do you return "No such contact"

  2. You return "No such property" under the wrong conditions

I’m not sure how you tested it, but this code definitely does not work.


thank you for your feedback

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