doc: fix extension in esm example

PR-URL: https://github.com/nodejs/node/pull/33408
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
This commit is contained in:
Gus Caplan authored and Shelley Vohr committed 2020-05-17 09:01:21 -07:00
1 parent 24faa37a09
commit 7f9ccd6d89
1 file changed
+4 -4
+4 -4
View File
@@ -16,7 +16,7 @@ code for reuse. Modules are defined using a variety of [`import`][] and
The following example of an ES module exports a function:
```js
// addTwo.js
// addTwo.mjs
function addTwo(num) {
return num + 2;
}
@@ -24,11 +24,11 @@ function addTwo(num) {
export { addTwo };
```
The following example of an ES module imports the function from `addTwo.js`:
The following example of an ES module imports the function from `addTwo.mjs`:
```js
// app.js
import { addTwo } from './addTwo.js';
// app.mjs
import { addTwo } from './addTwo.mjs';
// Prints: 6
console.log(addTwo(4));