Access object based on a string reference

Hello all,

I have an object which is access this way
states.us
which has an array of all states in the us, also in the same object there are states for other countries, my questions is, given I have this:

country=“us”;
how could I access the object by doing:
states.country

I have been looking around but I can’t find this, is it possible or do I have to habdle this some other way?

I just figured it out, I was trying object.{string} and also object.[string] but it should be object[string] without the dot