Javascript: Profile Lookup from freecodecamp
You have very repetitive code. This can be optimized. I'm not sure whether your function name lookUpProfile is the correct one, as you actually look up a property of a Contact and not its whole profile. But if the task is to look up a certain property of a Contact you can simplify the code to this:

function lookUpProfile(firstName, prop) {
    for (let contact of contacts) {  
        if (contact.firstName === firstName) {
            return contact[prop];
        }
    }
    return false;
}


How it works

It loops through all contacts:

for (let contact of contacts) {


It tests whether the firstName matches:

if (contact.firstName === firstName) {


In case a match is found it returns the requested property or undefined:

return contact[prop];


In case no match is found it returns false:

return false;


What it returns

This function will have a mixed return value. The code that is calling the function can now deal with the result. It will return one of the following:


false if no Contact with the requested firstName exists
undefined if a Contact matches but the requested property doesn't exists
string|array if a match was found and the property exists


So all those calls will work:

console.log(
    lookUpProfile(),
    lookUpProfile('A'),
    lookUpProfile('Sherlock'),
    lookUpProfile('Sherlock', 'number'),
    lookUpProfile('Kristian', 'likes')
);


The return values are:

false false undefined 0487345643 Array [ "Javascript", "Gaming", "Foxes" ]


What the code doesn't do:

It doesn't check whether there's a choice for Contacts, i.e. if more than one Contact with that name exists. It will always exit at the first match.

jsFiddle Demo

Try before buy



Update "No such property"

Regarding the OP's comment about a different return value, I would suggest keeping the code as is and let other parts worry about a concrete message:

var value = lookUpProfile('Sherlock', 'random');

if ('undefined' === typeof value) {
    console.log('No such property');
};


If your task is to include that text into the function you can replace this line:

return contact[prop];


with:

return 'undefined' === typeof contact[prop] ? 'No such property' : contact[prop];


This is a lot harder to handle, as the string "No such property" could be an actual value of a property.