Tell us what’s happening:
I know my solution to this challenge is very different to the solutions given by fCC.
I’d like to know whether there’s something of value in it. The if statement seemed to work fine. I’d rather do it this way, for it’s the way I could do and understand.
I still don’t know why the error is in the return statement if the rest is fine.
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
if (name == "firstName" || "lastName");
if (prop == "number" || "likes") {
return ["value"];
}
}
for ( ; prop != ["number" || "likes"] ; ) {
return "No such property";
} for ( ; contact != ["firstName"] || ["lastName"] ; ) {
}
return "No such contact";
// Only change code above this line
lookUpProfile("Akira", "likes");
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36.
Why are you using for loops like this? Don’t do that!
How do you intend this code to function? I’m honestly confused and I find that trying to make a sentence to describe what each line does helps in cases like this.
I’m sorry. I have a psychiatric treatment so some things do not stick. I’m at more or less 90 percent of the curriculum of Basic JavaScript I think I should know better than use certain code. I studied a bit of Python but I don’t think that’s the problem.
It’s hard for me to land the more basic concepts. It sounds like an excuse, but it’s like that.
I think that you might want to repeat some of the fundamentals. Give it as much time and repetition as you need to feel comfortable with it. Right now the only correct lines are
I’d focus on the lessons about strict comparisons, if statements, for loops, accessing object properties with bracket notation, and accessing array entries.
Thank you. I work mostly at night because in the day I have to take care of my sick mum. So it’s hard some times to dedicate all the time and dedication I’d like to and is needed.
But I’m not going to surrender. Thank you for your words.
don’t be afraid to have two windows open side by side, one with current challenge and one with previous ones/documentation
also, once you do not have syntax errors, you could use a tool called pythontutor to see your code executed (it works for many languages, not just python)