Node.js · Junior · Question 16 of 75
Which variables are not available in an ES module but exist in CommonJS?
- ✓Correct answer:
__dirnameand__filename(useimport.meta.dirnameandimport.meta.filename) - 2
setTimeoutandsetInterval - 3
consoleandprocess
Explanation
CommonJS wraps each file in a function that receives __dirname and __filename. In ESM the same information is on import.meta, including import.meta.url.