Skip to content

Instantly share code, notes, and snippets.

@daegren
Last active September 4, 2017 19:58
Show Gist options
  • Save daegren/f0f7e3ec4b16063501146a233e10d193 to your computer and use it in GitHub Desktop.
Save daegren/f0f7e3ec4b16063501146a233e10d193 to your computer and use it in GitHub Desktop.
W1D1 Example
// Requirements:
// - Take in two numbers from the command line
// - `console.log` the sum of the two numbers
var input1 = process.argv[2];
var input2 = process.argv[3];
var number1 = parseInt(input1);
var number2 = parseInt(input2);
if (isNaN(number1) || isNaN(number2)) {
console.log('Please enter some valid numbers.')
} else {
var result = number1 + number2;
console.log('Sum of ' + number1 + ' + ' + number2 + ' = ' + result);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment