Javascript query

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

In this code , I’m unable to access the property by “return contacts[x].prop”, why do we only need braces notation to access the property?

Okay, I got it!
Thank you!!