I have an array of strings like this:
const deepProperties = ['contactPerson', 'firstName']
How can access the property contactPerson.firstName
(get and set) of an anonymous object having this string array at hand?
const unknown = { contactPerson: { firstName: 'Jane' } }
I know I can do unknown['contactPerson']['firstName']
to get the value and unknown['contactPerson']['firstName'] = 'John'
to set a new value - but how do I get there from the array?