liveBook · Manning

Require

As explained in Secrets of the JavaScript Ninja, Second Edition

A CommonJS function that loads a module and returns its exported interface.

require is a CommonJS function that loads a module and returns its exported interface. It provides access to a module’s functionality while module boundaries help keep implementation details hidden. section 11.1

How Secrets of the JavaScript Ninja, Second Edition covers it

How deep it goes
Introduces CommonJS as a module specification without detailing require’s loading mechanics.
What you can do after
Understand how require provides access to a module’s exported functionality.
How it connects
Connects require to CommonJS, module interfaces, and hiding implementation details.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Secrets of the JavaScript Ninja, Second Edition. The section links point to the parts of the book it draws on.