Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: fix extension in esm example #33408

Merged
merged 1 commit into from May 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions doc/api/esm.md
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:
devsnek marked this conversation as resolved.
Show resolved Hide resolved

```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