Closed cklaffer closed 6 months ago
Try
// import readline module
const readline = require("readline");
// create interface for input and output
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
// create empty user input
let userInput = "";
// question user to enter name
rl.question("What is your name\n", function (string) {
userInput = string;
console.log("Your name is " + userInput);
// close input stream
rl.close();
});
from https://www.educative.io/answers/how-to-get-user-input-from-command-line-with-javascript
Works perfectly for me. Please reopen the issue if the problem persists
Can anyone point me in the right direction, how to use stdin in JavaScript code blocks?
I don't seem to get anything
require("readline")
- related working. And only usingprocess.stdin.readLine()
Thanks a lot!