Node.js: getting started

Lesson 02 · 10 min

Modules and npm

import/export split code into files, npm brings in other people's.

Every file is a separate module with its own scope. What you don't export can't be seen from outside. The modern syntax is ES modules (import/export). The older CommonJS (require/module.exports) still shows up in libraries and configs.

Sign in to continue

The rest of this lesson opens after sign up

The first lesson of every course is open without an account. To read on, solve the practice and use Ask, create a free account or log in.