Pls. can anyone help on this?
What is that two dots under require? and its not showing output result?
When trying to type in the output terminal, its not typing anything?
Thanks.
I am trying this code today and i could not give the user input.
Pls. can anyone help on this?
What is that two dots under require? and its not showing output result?
When trying to type in the output terminal, its not typing anything?
Thanks.
I am trying this code today and i could not give the user input.
When you bring your cursor to dots you can see message like this:
File is a CommonJS module; it may be converted to an ES module.
You can either use Quick Fix or change your import like this:
import readline from "readline";
Also, do not forget to add "type": "module", to your package.json
Edit
In your code you imported readline as rLine but while you are creating interface you used it as readline.createInterface() you should update your code like this:
import readline from "readline";
var rl = readline.createInterface(process.stdin, process.stdout);
rl.question("What is your name?\n", (answer) => {
console.log(answer);
});