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'.