My coding journey: Truthy & Falsey — learning JavaScript

My coding journey: Truthy & Falsey — learning JavaScript

Image by Obi Onyeador | Accessed at

Harking back to an unpublished blogpost originally drafted in December…

Our mentors delivered us an early Christmas present this week (10th December 2018)…the challenge to learn JavaScript ?.

First we had an introductory session with our mentor to get our systems set up, and ensure that we could test our files using JEST (command: npm test). This being my first introduction to JavaScript, I noticed a few obvious differences even during this set-up phase:

  1. the file structure — this time our test files are stored in a folder named __tests__. (The underscores in the folder name ensures that your test folder is always at the top of your file directory).
  2. module.exports — you need to specifically export javascript classes at the end of your file so that you can test them. Otherwise your class (and all of it’s functions) aren’t accessible outside of your file and your tests can’t run. We actually found that in our case, using a more modern ES6 we needed to export class Example at the point where we defined the class itself.
  3. Javascript uses function, rather than methods which are defined using def in Ruby. Functions need an explicit return at the end of them. Conversely Ruby generally uses implicit returns, automatically returning the value of the last thing it executes in your method.

Much of this week entailed individually working through the Codecademy JavaScript tutorials and reading through jS documentation to support what we were learning.

By Thursday afternoon we were ready to pair on the Coinchanger kata. Having already built coinchanger in Ruby during our first week at 8th Light, the challenge was to understand a new language by applying it to a familiar problem. You can see the differences in syntax by comparing my two repos:

Coinchanger in Ruby:

Coinchanger in Javascript:

Another key part of my week was making further improvements to my todo list Sinatra application. This was initially prompted during a pairing session with our new mentor Laurent mid-week. He gave me feedback on my code and introduced me to REST and HTTP Verbs.

During my WAZA time on Friday afternoon I continued this by reading through various resources. I really enjoyed understanding the different types of requests you can make to an application, and how you can encourage your application to behave more harmoniously by using the relevant HTTP verb.

Explaining HTTP Verbs and their URL paths…

If HTTP Verbs and REST is something you’ve not yet heard of, stay tuned. I hope to pull my learning together in a future blogpost, including the resources which helped me as I continue working on my application.

Highlights from week eight…

Highlights this week:

  • pairing with Elle to build the coinchanger kata in JavaScript
  • pairing with Laurent on my To Do list and beginning to understand restful routes in Sinatra
  • Devlin’s Zagaku on asynchronous coding in JavaScript (promises, await and API calls)

Things I’ve learned:

  • how to run tests in JavaScript using JEST
  • the initial differences between Ruby and JavaScript
  • being a good developer is more than understanding or remembering coding languages. Being comfortable in finding out what you don’t know and identify helpful documentation is key

Things I’ve struggled with:

  • getting my head around asynchronous code – namely async/await and promises. Devlin’s Zagaku was perfectly timed for helping with this!

Things I’m curious about:

  • REST and HTTP Verbs

What I’d like to focus on:

  • making my To Do List a more RESTful Sinatra application
  • continuing to learn JavaScript