- Learning Node.js Development
- Andrew Mead
- 131字
- 2021-06-30 18:56:53
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.
- 計算機網絡與通信(第2版)
- SEO 20日
- Learning QGIS 2.0
- Force.com Development Blueprints
- Learning Karaf Cellar
- 區塊鏈輕松上手:原理、源碼、搭建與應用
- Yii Application Development Cookbook(Second Edition)
- 城域網與廣域網(第2版)
- Unity Artificial Intelligence Programming
- INSTANT KineticJS Starter
- 5G技術與標準
- 夢工廠之材質N次方:Maya材質手冊
- 端到端QoS網絡設計
- 5G非正交多址接入技術:理論、算法與實現
- Microsoft System Center 2012 Configuration Manager:Administration Cookbook