Next Steps

In this chapter, we showed how to use require to pull a module into your project, and we presented two ways to use module.exports. Of course, these are not the only ways to share content.

A quick search online shows that besides functions, we can also share individual variables. There are also alternative syntaxes for module.exports - even one that exports as an object, but imports as a function (which means no dot notation).

The skills you practiced in this chapter provide a solid foundation for modules. Learning the alternatives becomes a matter of personal preference and the requirements for your job.

If you would like to further explore content related to modules please view the following resources:

  1. mdn web docs on JavaScript Modules
  2. freecodecamp on JavaScript Modules
  3. geeksforgeeks on JavaScript Modules