Readline from Js

PHOTO EMBED

Tue Feb 24 2026 14:51:06 GMT+0000 (Coordinated Universal Time)

Saved by @Muhammadcodes #javascript

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)
content_copyCOPY