Skip to content

Commit

Permalink
doc: fix extension in esm example
Browse files Browse the repository at this point in the history
PR-URL: #33408
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
  • Loading branch information
devsnek authored and codebytere committed May 17, 2020
1 parent 24faa37 commit 7f9ccd6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions doc/api/esm.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ 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;
}

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));
Expand Down

0 comments on commit 7f9ccd6

Please sign in to comment.