Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save GregoryArmstrong/e92ea35a7a10b046c8a9 to your computer and use it in GitHub Desktop.
Save GregoryArmstrong/e92ea35a7a10b046c8a9 to your computer and use it in GitHub Desktop.
first_javascript_exercism_comparisons

Leap

My code: here

  • First Comparison - This individual's implementation is similar to mine, but uses a few if statements for each leap year criteria instead of just one with an additional || comparison.
  • Second Comparison - This individual's implementation used an if/elsif/else conditional for the 3 leap year criteria.
  • Third Comparison - This individual's implementation is almost identical to mine, but uses an if/else conditional to determine what to return. I almost like this better than mine because it's extremely explicit, but think mine is better refactored.
  • Fourth Comparison - This individual's implementation looks to be using ES6, as well as constants, classes and a constructor. It also looks to be using R to access its module function. Seems to be overkill.
  • Fifth Comparison - This individual's implementation uses the same basic comparison as mine, but isnt setting the isLeap function as a function of Year. It's actually returning a function called isLeap. Not sure if this is the same as my implentation and just syntactically different.

Hamming

My code: here

  • First Comparison - This is Shannon's implementation! I didnt know about the charAt function on String.prototype, and I really like how Shannon implemented that rather than my way of splitting the two strings and comparing them with indices. I also used a function to check the character lengths of the strings and to issue an error, but Shannon chose to have her compute function use an if/else conditional which issues the error if the strings' lengths are not equal. Cool way of doing it.
  • Second Comparison - This individual's implementation uses a very similar work flow to my implementation, but just tracks incorrect matches with an incrementing counter. I like this way of doing it better than my own, as now I realize creating an array of numbers correlating to correct matches is a little bit much when I couldve done the same thing by just incrementing a counter.
  • Third Comparison - This individual's implementation is very similar to the Second Comparison implementation, by using a for loop.
  • Fourth Comparison - This individual's implementation is also quite similar to the Second and Third Comparisons.
  • Fifth Comparison - This individual's implementation is also very similar to the Second, Third and Fourth Comparisons. I seem to have approached the problem somewhat differently than most of these. I think im still getting used to the way Javascript works, as my implementation is very Ruby-esque in syntax and implementation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment