Search⌘ K
AI Features

Input

Explore how to manage input in Node.js by learning command line argument parsing with process.argv and interactive console input using the readline module. This lesson helps you understand input handling fundamentals to build responsive Node.js programs.

We'll cover the following...

Command line input

Let’s start with the most basic form of input, the command line input. Depending on how much you have used a terminal before, you may or may not be familiar with passing input to a program using the terminal. Let’s see how we do that first.

Suppose we have a simple program called app.js. This program prints out whatever you pass to it. You can pass it arguments by simply writing them after the program’s name in the terminal. Try it out with the command node app.js Hello. Hit the RUN ...