1

In browser environment (for instance firefox 60+), I am trying to retrieve a class in the global window object, without success :

class c{};
console.log(window.c); // undefined

whereas for any other declaration

var foo = "bar";
console.log(window.foo); // bar

Where can I access declared class in the global object, for instance, if I need to create an instance from a class name stored in another variable.

Thank you.

2

1 Answer 1

1

This should work

var Test = class {}
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.