//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(firstNames, prop){
// Only change code below this line
  for (var i=0; i<contacts.length; i++){
    if(contacts[i].firstName == firstNames){
      for (var j=0; j<contacts[i].length; j++){
        if(contacts[i][j] == prop){
          return contacts[i][j].prop;
        } else {
          return "No such property";
        }
      }
    } else{
       return "No such contact";
    }
  }
  // Only change code above this line
}
// Change these values to test your function
lookUpProfile("Akira", "likes");
The above code doesn't work, specifically on the line with the for (var j=0; j<contacts[i].length; j++) line, as contacts[i].length is undefined, when I ran console.log statements into my code
How exactly do you define the length of an javascript object that is nested inside of another object?
reference example https://www.freecodecamp.org/challenges/profile-lookup
 
    