Getting an error on Profile Lookup challenge

function lookUpProfile(firstName, prop){
// Only change code below this line
for (var i = 0; i < contacts.length; i++){
if(contacts[i].firstName == firstName){
if(contacts[i].hasOwnProperty(prop)){
return contacts[i].prop;
}
else
return “No such property”;
}
else
return “No such contact”;
}
// Only change code above this line
}

//I am getting an error on it…

Check the if else structure. Curly braces, for example.

Always specify the error you’re getting and format your code with backticks (``` before and after your code). This way people can help you easier.

Solved!
function lookUpProfile(firstName, prop){
// Only change code below this line
for (var i = 0; i < contacts.length; i++){
if(contacts[i].firstName == firstName){
if(contacts[i].hasOwnProperty(prop)){
return contacts[i].prop;
}
else
return “No such property”;
}
/* else
return “No such contact”; */ // This stupidity i was doing

}return “No such contact”; // Actually should be like this
// Only change code above this line
}