-
Notifications
You must be signed in to change notification settings - Fork 16
day 1 #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
day 1 #3
Conversation
@@ -0,0 +1,7 @@ | |||
'use strict'; | |||
|
|||
const greet = require('./lib/greet.js'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool. Looks good. Modular.
|
||
greet.sayHi('Gary'); | ||
greet.sayBye(); | ||
greet.greetStranger(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice third function call here for the input method.
|
||
module.exports = exports = {}; | ||
|
||
var strangerName = process.argv[2]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work storing this in a semantic variable to make it easier to use later.
}; | ||
|
||
exports.greetStranger = function() { | ||
console.log(`Hi there, ${strangerName}!`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much easier to pass the variable you made in here than the process.argv line you otherwise would have had to. It's much more human readable.
}; | ||
|
||
exports.greetStranger = function() { | ||
console.log(`Hi there, ${strangerName}!`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, YEAH string interpolation!!
assert.ok(bye === 'See you later!', 'not equal to See you later!'); | ||
}); | ||
}); | ||
// attempt to test my command line argument, not sure how to do it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You would probably want to use process.argv here in your test and make sure the user input from the CLI lines up here. You'd need to basically manually set the name here into the process.argv array to be used in the function when it's called.
done