![]() ![]() Notice the first two elements - node and the path to your script. There you have it - an array containing any arguments you passed in. Now save it, and try the following in your shell: $ node argv.js one two three four five ![]() Make a file called argv.js and add this line: console. Node.js exposes this array for every running process in the form of process.argv - let's take a look at an example. In Node.js, as in C and many related environments, all command-line arguments received by the shell are given to the process in an array called argv (short for 'argument values'). Passing in arguments via the command line is an extremely basic programming task, and a necessity for anyone trying to write a simple Command-Line Interface (CLI). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |