- [Instructor] Readline is a module
that allows us to ask questions of our terminal user.
It's a wrapper around the standard input,
standard output process
that allows us to easily control the user prompt
without having to work directly with stdin and stdout.
So let's go ahead and create a new file here
in our start folder called ask.
We'll say ask.js.
And here we want to first import our readline function.
We'll say require readline.
And then we're going to create a variable called rl,
which is going to again be this wrapper
around standard input and standard output
in what's called an interface.
So the interface has an input,
which will map to process standard input.
And then output is process.standard output.
Then we'll call rl.question.
The first thing that this will take in is a string.
So we'll say how do you like Node?
Then we'll add a callback function here.
So we'll take in the answer.
And we'll say console.log,
Your answer is answer.
Nice, so now I'm going to try to run this.
I'll say node ask.
How do you like Node?
It's great!
And then it'll echo that answer back out to me,
which is pretty cool.
Nice, so at this moment,
we are successfully answering our own question.
In the next video, we're going to enhance this a little bit
by creating this as a function.