I am trying to find an object within an object based on a string value. For example:
var object = {'person1': {name: 'bill', hairColor: 'brown'}, 'person2': {name: 'joe', hairColor: 'black'}}
If I have the string 'person1' how would I find all their attributes from the object? If I try and do object.'person1' I get an error and I'm not sure how to change the string 'person1' into a non-string where I could then go object.person1 which works. Any thoughts?