Given an array of objects:
const items = [{ documents: { childDocument1: '123', childDocument2: '456' }, ... }];
And given a string:
const stringForDynamicSearching = "['documents']['childDocument1']";
I'd like to get the first item childDocument1 from this string, such as:
items[0][stringForDynamicSearching];
// I know that this will be read as:
// items[0]["['documents']['childDocument1']"];
// And this will not run correctly, since the ideal code would be:
// items[0]['documents']['childDocument1'];
But I need this to be dynamic from a string. Is it possible?