Skip to content

Home

Command-line arguments

Gets the command-line arguments passed to a Node.js script.

const getCmdArgs = () => process.argv.slice(2);

// node my-script.js --name=John --age=30
getCmdArgs(); // ['--name=John', '--age=30']

More like this

Start typing a keyphrase to see matching snippets.