Deviopath › Node.js

Greet from the Command Line

Easy · CLI

When you run node app.js Ana, Node puts the command line in process.argv, roughly ["node", "app.js", "Ana"]. The first two items are the Node program and the script, so your own arguments start at index 2.

Write a function greet(argv) that returns "Hello, <name>!" using the first argument. If there is no argument (or it is an empty string), return "Hello, world!".

Next: Status Code Class