I just started on this question and I’m a little stuck. I kind of froze and not sure if the things I was and currently doing was correct. I shorten it down so I can start off somewhat fresh but what am I doing wrong and what I should do?
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(firstName, prop){
// Only change code below this line
for (var i = 0; i < contacts.length; i++) {
}
var values = contacts[prop];
if (firstName == true && prop == true) {
return values;
} else if (firstName == false) {
return "No such contact";
} else if (prop == false) {
return "No such property";
}
// Only change code above this line
}
// Change these values to test your function
lookUpProfile("Akira", "likes");
Link to the challenge:
https://www.freecodecamp.org/challenges/profile-lookup