Accessing the command-line argument for the notes application

Let's access the command-line argument in the array now. We'll make a variable called command, and set it equal to process.argv, and we'll grab the item in the third position (which is list, as shown in the preceding command output), which is the index of two as shown here:

var command = process.argv[2];

Then we can log that out to the screen by logging out command the string. Then, as the second argument, I'll pass in the actual command that was used:

console.log('Command: ' , command);

And this is just a simple log to keep track of how the app is getting executed. The cool stuff is going to come when we add if statements that do different things depending on that command.