Profile Look up... cant understand why its not working

// 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(name, prop){

for(var i = 0; i < contacts.length; i++){
    if(contacts[i].firstName === name){
        return contacts[i][prop] || "No such contact" ;
return "No such property";

lookUpProfile("Akira", "likes");

my error is why its not returning :
"Bob", "number" should return “No such contact”

"Bob", "potato" should return “No such contact”

"Akira", "address" should return “No such property”


For Bob, your program will look for Bob and number. It will return “No such property” because the loop ends without ever finding a contact with the first name: ‘Bob’.

For Akira, your program does find a contact with the first name (‘Akira’), but because there is no address prop, your program returns ‘No such contact’. Your function ends right there.

When you return something, the function concludes.

I think you have the “no such property” and “no such contact” the wrong way around. If your if statement is true then it should either return the property, or “no such property”

hope that helps :slight_smile: