Exercism JS: Hello World

Write a function that greets the user by name, or by saying “Hello, World!” if no name is given.

My solutions: 

screen-shot-2016-12-09-at-1-30-21-pm

Note to self:  Don’t forget ’em brackets, semi-colons, and ‘===’.

Test Cases:

screen-shot-2016-12-09-at-1-30-56-pm

I was going to skip this problem since I solved it in Ruby already, but good thing I decided not to because JS syntax is a totally different & confusing beast.

More implementations to mull over here.

Also, here’s how to run exercism tests with jasmine-node:

Change ‘xit’ to ‘it’ when you’re ready to run a test case.

Execute the test file with the following code:

cd ~/exercism/javascript/bob
jasmine-node bob_test.spec.js
Advertisements
Exercism JS: Hello World

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s