From the course: Node.js Essential Training

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Working with standard input

Working with standard input - Node.js Tutorial

From the course: Node.js Essential Training

Working with standard input

- [Instructor] Another feature of the process object is standard input and standard output. These two objects offer us a way to communicate with a process while it's running. So what we're going to do next is we want to make sure that we're in our global file and that we're navigated to the right spot in the terminal, get rid of the code that's here, and replace this with process.stdout.write, and here, we're just going to add Hello, a couple of spaces, and let's try to run this. So node global, and then we'll see Hello, and then when we use stdout.write, we're sending some strings to the terminal. So here what we could do is add some new lines with the \n, and then this is going to add those lines for us. What we want to do next is we want to create an array of questions. So here we'll say const questions, and we'll add a few strings here. So we'll say, What is your name?, What would you rather be doing?, and then…

Contents