0
const array_of_property_names = ["A", "B", "C", "D"];

const nested_obj = {
  A: {
    B: {
      C: {
        D: 1
      }
    }
  }
}

In the event that array_of_property_names is dynamic, how can we use it to modify nested_obj?

  • 1
    related: [Access a nested property with a string](https://stackoverflow.com/questions/33066787/access-a-nested-property-with-a-string) – pilchard Jun 19 '22 at 09:44
  • Are you after something like [this](https://stackoverflow.com/q/66598458/5648954)? – Nick Parsons Jun 19 '22 at 09:53

0 Answers0