So we installed NodeJS on our machine.
Now we want to write a simple script, run it from the terminal & use some commandline arguments.
echo "console.log('Hello')" > index.js
index.jsto use the commandline arguments and print them:
echo "const args = process.argv" > index.js echo "console.log(args)" >> index.js
node index.js miku86
[ '/usr/bin/node', '/home/miku86/index.js', 'miku86' ]
args is the path to the executable file, args is the path to the executed file, args is the additional commandline argument from step 2.
processor some libraries like
Hi! I'm Michael 👋 I'm a Mentor & Senior Web Developer - I help you to reach your (career) goals.