1>>node myprogram.js firstarg secondarg
2
3process.argv[0] == "path/to/node"
4
5process.argv[1] == "path/to/myprogram.js"
6
7process.argv[2] == "firstarg"
8
9process.argv[3] == "secondarg"
10
11//process.argv[0] same as process.argv.slice(0)
1process.argv.slice(2).reduce((processArgs, val) => {
2 let [key, value] = val.split('=');
3 processArgs[key] = value;
4 return processArgs;
5}, {})
6