for (var x = 0; x <contacts.length; x++){
if (contacts[x].firstName == name && contacts[x].hasOwnProperty(prop)){
return contacts[x][prop];
} else {
return "No such property";
}
}
return "No such contact";
why don’t you try to see what your function actually returns?
try with for example adding the following on the last of the editor: console.log(lookUpProfile("Kristian", "lastName"))