Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

nodejs ask for input

let userInput = ask("What is your name?")
//user types: Joe
console.log(userInput) // prints Joe

const prompt = require("prompt-sync")();  

function ask(message) {
  let input = prompt(message);
  return input;
}
 
PREVIOUS NEXT
Tagged: #nodejs #input
ADD COMMENT
Topic
Name
1+6 =