Skip to content

Commit b3ea8f1

Browse files
Mesteeryjuanarbol
authored andcommitted
doc,readline: add missing node protocol in example
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]>
1 parent 1808572 commit b3ea8f1

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

doc/api/readline.md

+14-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,20 @@ const readline = require('readline');
1616

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

19-
```js
19+
```mjs
20+
import * as readline from 'node:readline/promises';
21+
import { stdin as input, stdout as output } from 'node:process';
22+
23+
const rl = readline.createInterface({ input, output });
24+
25+
const answer = await rl.question('What do you think of Node.js? ');
26+
27+
console.log(`Thank you for your valuable feedback: ${answer}`);
28+
29+
rl.close();
30+
```
31+
32+
```cjs
2033
const readline = require('readline');
2134

2235
const rl = readline.createInterface({

0 commit comments

Comments
 (0)