Exporting a Class or Object

Learn how to export a class or object in Node.js.

We'll cover the following

Numerous modules in the Node.js ecosystem export only a single object aggregating all of the module’s functionality. To do so, they reassign the module.exports object instead of adding properties to it. For example, check out how the following module calculator.js is defined.

Get hands-on with 1200+ tech skills courses.