How to pass command line arguments to a Node.js ?

Explanation

 You can pass command-line arguments to a Node.js program by the following statement:

var args = process.argv.slice(2);

Here we have to remember that the first arg is usually the path to nodejs, and the second arg is the location of the script you’re executing.

 

Also read, How can I determine the URL that a local Git repository

Share this post

Leave a Reply

Your email address will not be published. Required fields are marked *