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 - 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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Inspecting the global object3m 46s
-
(Locked)
Using the require function3m 4s
-
(Locked)
Handling argument variables with process.argv3m 29s
-
(Locked)
Working with standard input3m 37s
-
(Locked)
Using standard output3m 13s
-
(Locked)
Creating a delay with setTimeout2m 3s
-
(Locked)
Incorporating setInterval2m 51s
-
(Locked)
Reporting progress with setInterval1m 43s
-
-
-
-