Hi, I’m redoing the JavaScript curriculum and got up to this challenge. For me the code is fine, I don’t understand why it is getting errors (not syntax errors, working errors). If someone can please help me here I’d be thankful.
// 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" && name.hasOwnProperty(prop)) {
return prop;
} else if (!name.hasOwnProperty(prop)) {
return "No such property";
} else if (name = undefined) {
return "No such contact";
}
}
// Only change code above this line
lookUpProfile("Akira", "likes");