The title says it all. The only thing I can find is that global variables are stored under the window, but this does not look like classes defined using the class keyword.
class Foo {
constructor() {
console.log('A Foo is created');
}
}
const foo = new Foo();
const bar = new window['Foo']();
Run codeHide resultI know you can write something like let Foo = class Foo {}, but I would like the redundancy to be low. In addition, I am interested in whether a true, inoperative solution exists only out of curiosity.
source
share