Good day. I had a question, how to create an object, having a class name in a variable? Is there a similar feature like the one implemented in php:
$className = 'MyClass'; $newObj = new $className(); Thank you in advance for your help.
On a tip, @Other did this:
"use strict"; class Maxy { constructor() { this.Name = undefined; } Render() { console.log('Rendering...') } } let Maxies = { Mini1: class extends Maxy { }, Mini2: class extends Maxy { }, Mini3: class extends Maxy { } }; function CreateMini(Type) { let Mini = new Maxies[Type]; return Mini.Render(); } console.log(CreateMini('Mini2'));