Command Line Arguments
process.argv lists the arguments. The first two are node and the script. Use process.argv.slice(2).
Example
const args = process.argv.slice(2);
console.log(args.length, args);
const [name = "world"] = args;
console.log(`Hello ${name}`);Result
0 [] Hello world
Exercise
User arguments.
process.argv.(2)
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.