Profile Lookup(Potential bug with FFC IDE)

Tell us what’s happening:
Hello Everyone,

I just want to make this post because I’m experiencing an issue with what might FCC’s IDE.
I say this because I have actually tested my code in other editors(replit, jsbin, firefox and chrome’s console)
When I input my answer for this challenge on FCC’s IDE everything passes except for the last set of
params( "Akira", "address")

What’s interesting is that if I console.log this answer it does return “No such property”(The intended output)

Does anyone know what’s going on or encountered an error like this?

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(let i = 0; i < contacts.length; i++){
      if(contacts[i].firstName === name ){
        if(contacts[i].hasOwnProperty(prop)){
          return contacts[i][prop]
        }else {
          return "No such proptery"
        } 
    }
  };
      return "No such contact"
} 
// Change these values to test your function
lookUpProfile("Akira", "likes");

Your browser information:

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

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

Hi. there is a small typo on line 37 :slight_smile:

change

      return "No such proptery"

to

return “No such property”

it should work as expected afterwards :slight_smile:

1 Like

Thank you so much,
I can’t believe I didn’t catch that :rofl:

1 Like