المعرفة:: NodeJS الحالة::مؤرشفة المراجع:: The Complete Node.js Developer Course 3rd Edition
- Command line arguments are values passed into the application from the terminal.
- The Node.js application can access the command line arguments that were provided using process.argv. This array contains at least two items.
- The path to the Node.js executable.
- The path to the JavaScript file that was executed.
- Everything after that is a command line argument.
- The script above grabs the third item in
process.argv
. Since the first two are always provided, the third item is the first command line argument that was passed in. The script uses the value of that argument to figure out what it should do.