How to Read Program Arguments in JavaScript

In JavaScript (nodejs) you can access the program arguments in the array process.argv. Like in C it includes the program name but unlike e.g. PHP and Ruby it also includes the path to the intepreter (the path to the node executable). Thus you have to skip two entries in the array to get to the real arguments to the program.

var args = process.argv.slice(2);
args.forEach(function (val, index, array) {
  console.log('Hello ' + val);

Run the code with node test.js one two "Claus Witt".