Is it possible to create an object in Javascript generically from a string class name similar to Java? Maybe some type of Factory?
I want a database to hold a list of class names. Each class name will be associated with a user friendly name. These user friendly names would populate a menu. When a user selects a menu item, the respective class name will be retrieved and the class (object) created. I currently do something similar in Java.
For example, instead of
var obj = new demo.view.CustomObject({});
I would like something like this
var obj = Factory.create('demo.view.CustomObject', params);
Thank you