13.5. Wrap-upΒΆ
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.