Skip to content

finished lab#1

Open
khalidM3 wants to merge 2 commits intocodefellows-javascript-401d13:masterfrom
khalidM3:master
Open

finished lab#1
khalidM3 wants to merge 2 commits intocodefellows-javascript-401d13:masterfrom
khalidM3:master

Conversation

@khalidM3
Copy link
Copy Markdown

No description provided.


const greeting = require('../lab-khalid/lib/greet.js');
console.log('working')
greeting.hello(process.argv[2])
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good use of process.argv here.

exports.hello = function(name) {
if(arguments.length === 0) throw new Error('Name not received');
console.log(name);
return `Hello, ${name}!`;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

String interpolation! Woohoo!

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

module.exports = exports = {};
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're only putting a single function on module.exports, so you don't need to make it an empty object to attach to.

const greeting = require('../lib/greet.js');
const assert = require('assert');
describe('Greeting module', function() {
describe('#hello', function(){
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good use of # before the function name in your test's describe block.

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