I'm trying to read in a word from the console to use in a hangman-like application. So far the prompt of "enter your word" is showing up, but the application won't wait for input to continue.
I've set VS code to use an external console, tried using different methods without readline, and watched a few videos to try and get this to work.
var readline = require('readline');
var rl = readline.createInterface(process.stdin, process.stdout);
function getWord(){
var word = "";
rl.question("Enter your word", function(answer){
word = answer
})
var wordArray = word.split('');
return wordArray;
}
console.log(getWord());
I would expect it to wait for input then continue but it doesn't.