Tell us what’s happening:
Describe your issue in detail here.
Hi! I need help with this project. This is my second time through the Basic JavaScript lessons and this time I decided to take notes as I go…though it doesn’t seem to be helping much. Here is my code so far…I basically wrote pseudocode and I know it’s not even close. Does anyone have any videos that explain this concept clearly? I am still struggling with for loops which is what I think I need here. I looked at the solutions a bit ago and saw that it seemed to use those, but I am not sure how to get it myself.
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
if ("firstName" === name && prop is there) {
return value
} if ("firstName" != name) {
return "No such contact"
} else if prop != prop {
return "No such property"
}
// Only change code above this line
}
lookUpProfile("Akira", "likes");
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36
Challenge: Basic JavaScript - Profile Lookup
Link to the challenge: