Skip to content

Commit 8c70f79

Browse files
Trottaddaleax
authored andcommitted
doc: clarify introductory module material
PR-URL: #9816 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Prince John Wesley <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Sam Roberts <[email protected]>
1 parent 2e22fa0 commit 8c70f79

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

doc/api/modules.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,25 @@
66

77
Node.js has a simple module loading system. In Node.js, files and modules
88
are in one-to-one correspondence (each file is treated as a separate module).
9-
As an example, `foo.js` loads the module `circle.js` in the same directory.
109

11-
The contents of `foo.js`:
10+
As an example, consider a file named `foo.js`:
1211

1312
```js
1413
const circle = require('./circle.js');
1514
console.log(`The area of a circle of radius 4 is ${circle.area(4)}`);
1615
```
1716

18-
The contents of `circle.js`:
17+
On the first line, `foo.js` loads the module `circle.js` that is in the same
18+
directory as `foo.js`.
19+
20+
Here are the contents of `circle.js`:
1921

2022
```js
2123
const PI = Math.PI;
2224

2325
exports.area = (r) => PI * r * r;
2426

2527
exports.circumference = (r) => 2 * PI * r;
26-
2728
```
2829

2930
The module `circle.js` has exported the functions `area()` and

0 commit comments

Comments
 (0)