Please, help me, I am stuck. I do not understand what is wrong but I am half way through this challenge and do not want to copy paste a complete correct code from the video… I know that I’m close but I just cant wrap my head around it…
Thanks
// 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 (name === contacts[i].firstName) {
return contacts[i][prop] || “No such property”
}
return “No such contact”}
// Only change code above this line
}
lookUpProfile(“Akira”, “likes”);