Skip to content

Commit

Permalink
doc,readline: add missing node protocol in example
Browse files Browse the repository at this point in the history
PR-URL: #41560
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
Mesteery authored and juanarbol committed May 31, 2022
1 parent 1808572 commit b3ea8f1
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion doc/api/readline.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,20 @@ const readline = require('readline');

The following simple example illustrates the basic use of the `readline` module.

```js
```mjs
import * as readline from 'node:readline/promises';
import { stdin as input, stdout as output } from 'node:process';

const rl = readline.createInterface({ input, output });

const answer = await rl.question('What do you think of Node.js? ');

console.log(`Thank you for your valuable feedback: ${answer}`);

rl.close();
```

```cjs
const readline = require('readline');

const rl = readline.createInterface({
Expand Down

0 comments on commit b3ea8f1

Please sign in to comment.