sheep_knight
sheep_knight

Reputation: 11

javascript can I get class from it's name?

I was wondering if there is a function in javascript that returns the class if we add a parameter,

for example :

myClass extends someClass{

// My code here.

}

and somewhere else I could do :

let class = getClass("MyClass");

Or I should do a registering process (like putting my class in an array...).

Thanks.

Upvotes: 1

Views: 63

Answers (1)

István
István

Reputation: 5127

If you use eval('myClass') that will return the class, but it won't work with eval('MyClass')

Upvotes: 1

Related Questions