0

My question is quiet simple.

I have an object that looks like that:

const person = {
   name: 'David',
   locations: [
      {
         country: 'Belgium',
      },
      {
         country: 'France',
      },
      {
         country: 'Ireland',
      },
   ],
};

For example I have "person.locations[0].country" as string, that mix dot-notation and bracket notation.

is there a way to convert to an actual chain of property accessor that returns a value?

Thank you.

Simon
  • 209
  • 4
  • 12

0 Answers0