Contacts var is an array of objects. Variable x is used to access object at index x and prop var is used to access property inside the object at index 'x'. In javascript objects, properties can be accessed using two ways: dot notation or bracket notation. For dot notation, property must be a valid javascript identifier. For bracket notation, it should be a string (or symbol ). As prop variable is a string we can access its value using bracket notation.
You can learn more about property accessing in javascript objects here