Question 9 of 10Pro Only
What is the difference between ES Modules (import/export) and CommonJS (require/module.exports)? When would you use each?
Sample answer preview
## Overview Two module systems in JavaScript: - **CommonJS (CJS)**: Node.js original system - **ES Modules (ESM)**: Modern JavaScript standard ## CommonJS (require/module.exports) ```javascript // math.js - Exporting module.exports = { add: (a, b) => a + b, subtract: (a, b) => a…
ES ModulesCommonJSimportexportrequiremodule.exports