Skip to content

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

GLSea1979
Copy link

done

@@ -0,0 +1,7 @@
'use strict';

const greet = require('./lib/greet.js');

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();

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];

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}!`);

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}!`);

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.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants