So i’ve made it this far, but this latest error is driving me NUTS! (in chrome) I cant see any extra or missing semi colons… And in I.e. i get a different error! (expceted a WHILE… go figure?) Yet when i paste this code into Visual studio it seems to work just fine?
any help? i’d like to ‘complete’ the task and move to the next, but I’m completely lost about this semi colon…?? Here’s my code:
//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 matched = false;
var i = 0;
do {
if (firstName === contacts[i].firstName) {
matched = true;
if (contacts[i][prop]) { return contacts[i][prop]; }
else { return "No such property"; }
}
else {
i++;
if (i === contacts.length) { return "No such contact"; }
}
}while (!matched && i < contacts.length);
// Only change code above this line
}
// Change these values to test your function
lookUpProfile("Akira", "likes");