We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Node.js Modules

By default, Node.js uses the CommonJS syntax for modules. There are two ways you can manually switch to ES6 module syntax:

  1. Add "type": "module" to your package.json file
  2. Rename your module files to .mjs instead of .js

Personally, I prefer the first option. It's cleaner and easier to manage. And remember, if you're not using ES6 modules, your code will not be in strict mode by default!

Assignment

Let's do what the JavaScript system should have done years ago and migrate our code from CommonJS to ES6 modules.

Run and submit the CLI tests.