Help on Profile Lookup

Alright I’m on the profile lookup question and I currently don’t have any of the task ticked off but what I’m struggling with is the if statement and probably the loop as well. I don’t know how you can loop through the contacts list and take the information you ask for. Is there any resources I can look into or a hint on what I’m doing correct or wrong so I can figure it out by myself?


//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){
// Only change code below this line

var value = [];

for (var i = 0; i < 5; i++) {
    for (var j = 0; j < 5; j++) {
        value.push(contacts[i][j]);
    }
}

if (contacts[i][j].hasOwnProperty(name) && contacts[i][j].hasOwnProperty(prop)) {
    return value[name][prop];
} 

// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Akira", "likes");

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/profile-lookup