Hi guys,
So I wrote this code but I can’t seem to figure out what’s wrong with it. Any kind of help would be appreciated.
//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
var answer = "";
switch(firstName, prop){
case "Kristian", "lastName":
answer = "Vos";
break;
case "Sherlock", "likes":
answer = ["Intriguing Cases", "Violin"];
break;
case "Harry", "likes": // returns ["Intriguing Cases", "Violin"] instead of ["Hogwarts", "Magic", "Hagrid"]
answer = ["Hogwarts", "Magic", "Hagrid"];
break;
case "Bob", "number":
answer = "No such contact";
break;
case "Akira", "address":
answer = "No such property";
break;
}
return answer;
// Only change code above this line
}
// Change these values to test your function
lookUpProfile("Bob", "number");