interface.question()

rl.question(query, callback)

Prepends the prompt with query and invokes callback with the user's response. Displays the query to the user, and then invokes callback with the user's response after it has been typed.

This will also resume the input stream used with createInterface if it has been paused.

If output is set to null or undefined when calling createInterface, nothing is displayed.

Example usage:

rl.question('What is your favorite food?', (answer) => {
  console.log(`Oh, so your favorite food is ${answer}`);
});
doc_Nodejs
2016-04-30 04:40:16
Comments
Leave a Comment

Please login to continue.