Where did I go wrong here?

I wrote:

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

Iā€™d review when you can use dot notation and when you need to use bracket notation when accessing object properties.

1 Like

This is some documentation on what @bbsmooth is recommending

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.