Module Definition Patterns (II)
Learn about exporting an instance and modifying other modules.
We'll cover the following
Exporting an instance
We can leverage the caching mechanism of require()
to easily define stateful instances created from a constructor or a factory, which can be shared across different modules. The following code shows an example of this pattern:
Get hands-on with 1400+ tech skills courses.