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 <[email protected]>
Reviewed-By: Myles Borins <[email protected]>
  • Loading branch information
devsnek committed May 17, 2020
1 parent c1ee70e commit b46bbf2
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 b46bbf2

Please sign in to comment.