Skip to content

Instantly share code, notes, and snippets.

@topherPedersen
Last active May 1, 2019 00:27
Show Gist options
  • Save topherPedersen/7a3d5bf75e16681cb62fa08b6c2cb2d8 to your computer and use it in GitHub Desktop.
Save topherPedersen/7a3d5bf75e16681cb62fa08b6c2cb2d8 to your computer and use it in GitHub Desktop.
Command-Line User Input in JavaScript (node.js)
// User Input in NodeJS by Timmy Chen, Jaxatax, & topherPedersen
const readLine = require("readline-sync");
function input(prompt) {
const userInput = readLine.question(prompt)
return(userInput)
}
var myString = input("User Input Prompt: ");
console.log(myString);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment