node run parameters
var args = process.argv.slice(2);
node run parameters
var args = process.argv.slice(2);
process.argv
>>node myprogram.js firstarg secondarg
process.argv[0] == "path/to/node"
process.argv[1] == "path/to/myprogram.js"
process.argv[2] == "firstarg"
process.argv[3] == "secondarg"
//process.argv[0] same as process.argv.slice(0)
process.argv
process.argv.slice(2).reduce((processArgs, val) => {
let [key, value] = val.split('=');
processArgs[key] = value;
return processArgs;
}, {})
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us