I use class syntax for the definition of several prototypes. At a certain point in my code I have to create a new object but which object exactly depends on the prototype name which is stored as a string in a variable.
In Calling a JavaScript function named in a variable there is a solution to call a function when its name is stored in variable without using eval()
. How can I achieve the same thing for creating an object from a prototype like this parser = new VARIABLE_CONTAINING_PROTOTYPENAME
?