I am working on a project involving an array of strings that represent class names. My goal is to instantiate these classes using their string names, but so far my attempts with the window object have been unsuccessful.
The array structure looks like this:
var objects = ['string1', 'string2'];
So if we visualize it through the window object, it would appear as:
window [
objects [
'string1',
'string2'
]
]
I have attempted the following code snippet:
new window['objects'][0];
However, I received an error stating "the string is not a function."
Does anyone know a solution for achieving this task?
Appreciate any help or guidance provided.