1

In Python, one can use dir() to list the names of all modules and variables that are accessible at any point in the code. I wonder whether the same is possible in JavaScript.

I tried Object.keys(require('module')._cache); to see the modules, as indicated here, but I get 'require is not defined'.

1
  • The question you are refering to is about Node.js. And Node.js != Browser. Therefore require is not available to you. Commented Oct 30, 2022 at 9:33

0

Browse other questions tagged or ask your own question.