Skip to content

day 1#3

Open
GLSea1979 wants to merge 1 commit intocodefellows-javascript-401d13:masterfrom
GLSea1979:master
Open

day 1#3
GLSea1979 wants to merge 1 commit intocodefellows-javascript-401d13:masterfrom
GLSea1979:master

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