I solved the Basic Javascript : Profile Lookup for some reasons 1 point is blurry :
Why are we accessing properties in the object differently ?
Is the logic = We know the name of the property, so to access it ====> .firstName
?
Example : if (contacts[i].firstName .......
But when returning we don’t know the name of the property ====> [prop]
?
Example : return contacts[i][prop];
What is the rule behind this ? Why not something like : contacts[i].(prop)
?
Thanks