How can i list root objects JavaScript

  Kiến thức lập trình

So I have several objects and classes in my script tag

const Main = {}
const App = {}
class Game {}
let state = 777

etc. I’d like to list them.

I’ve tried
Object.keys(Object.getOwnPropertyDescriptors(window)).join(' ')

and

Object.getOwnPropertyNames(window).join(' ')

None of them work, but I’m able to list functions function example() {}

LEAVE A COMMENT