class User { say() { alert('Привет'); } } let nameClass = 'User'; const myObject = (Function('return new ' + nameClass))(); myObject.say();