Last active
September 4, 2017 19:58
-
-
Save daegren/f0f7e3ec4b16063501146a233e10d193 to your computer and use it in GitHub Desktop.
W1D1 Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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