import readline from 'readline'
function input(question){
return new Promise((resolve) => {
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
})
rl.question(question, (ans) => {
rl.close();
resolve(ans)
})
})
}
const name = await input("what's the name? ")
console.log("Hello: "+name)
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter