I thought it would be fun to write another tutorial on the next NodeSchool.IO tutorial. The next one is called 'Baby Steps'.

Write a program that accepts one or more numbers as command-line arguments and prints the sum of those numbers to the console (stdout).

Sounds easy enough. There is a few ways to do this. One of the easiest is to loop through the array using the .length property. As so.

    var result = 0

    for (var i = 2; i < process.argv.length; i++)
      result += Number(process.argv[i])

    console.log(result)

Is there another way to do this? I suppose you could try to do it with a foreach property or a while loop. You would need to make sure in each that you skip over the first two elements of the process.argv array.

The next NodeSchool tutorial are fairly easy. I'll skip to some of the later ones and continue on in a future post...