I have a constant which contains a list of classes:
const MY_LIST = [
MyClass1,
MyClass2,
MyClass3
];
I am trying to loop over the list of classes and call method of each class. Like this:
for(const myClass of MY_LIST) {
// this is where I try to dynamically create a class
const my = new myClass();
// this is where I am trying to call a method from dynamically created class
my.someMethod();
}
Do you see anything wrong with this approach? Does this make sense?