Skip to content

Instantly share code, notes, and snippets.

@greemwahr
Created March 3, 2017 01:09
Show Gist options
  • Save greemwahr/31eed98eccebc4c4e07be05c82f00ea3 to your computer and use it in GitHub Desktop.
Save greemwahr/31eed98eccebc4c4e07be05c82f00ea3 to your computer and use it in GitHub Desktop.
RisingStack Node Hero Readline Challenge
'use strict'
// app/readlineCalc.js
const readline = require('readline')
// const calc = require('./calc')
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
})
const sum = () => {
rl.question('Please input the first number you would like to sum: ', (input1) => {
rl.question('Please input the second number you would like to sum: ', (input2) => {
const results = +input1 + +input2
console.log(`This is the result of two numbers: ${results}`)
rl.close()
})
})
}
module.exports.sum = sum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment