Skip to content

Instantly share code, notes, and snippets.

@acareaga
Last active February 7, 2016 17:57
Show Gist options
  • Save acareaga/eb0023ad1680241845b1 to your computer and use it in GitHub Desktop.
Save acareaga/eb0023ad1680241845b1 to your computer and use it in GitHub Desktop.

JavaScript practice with Exercisms

Leap

My Code

  • Brenna did a nice job splitting the variable and logic into contained pieces. We followed a similar if/else pattern but I felt mine was more succint, using only one else statement.
  • I really like Jeff's implementation of the leap exercise. Similar logic but cleaner if/elsif/else statement. The code is very readable and seems more dynamic than my solution.
  • Astronautas solution is very straight-forward. I like how he initialized the leap variable as an empty function and contained logic to a seperate function. I designed my solution using one variable but felt the implementation maintained an appropriate level of clarity for the exercise.
  • Tgillus has an awesome implementation of the leap problem, clean code that is very readable. I really like the use of isDivisibleBy and isNotDivisibleBy in the single variable.
  • Mikegee used module.exports in an interesting way, combining multiple variables inside the function. I like seperating each piece so the logic inside the variables is clearly understood.

Hamming

My Code

  • Olgkv's solution to Hamming seems convoluted. It took a few times reading the code in order to understand each piece. The "try" and "checkHealth" section doesn't seem necessary.
  • Rocksell followed similar logic as to my solution. She kept everything contained to a single variable, whereas I broke out the distance function. I think my implementation is more future-proof.
  • Hamled also initialized the Hamming variable as an empty function, following a similar path to calculate the distance. I think splitting this portion into it's own function is better code.
  • Dreedle's solution is similar to Hamled's above. Although it makes more sense to me to extract the nested code, I think Dreedle did a better job with the if/while/if logic.
  • Mikegee used a straight module.export on the function instead of setting a variable, similar to his implementation of Leap. He also returned the computed result in a creative way.

RNA

My Code

  • Olgkv's answer to RNA Transcription is really clean. I like how he initialized the DataTranscriber variable and used another function to return the RNA strand.
  • Rocksell had a similar solution the the problem as I did. She broke out the variable and then called a function on it, whereas I called a single function.
  • TamarHershi used a lot of else if statements in her code. I think it makes it easy to reason through but has a lot of repetition. It makes more sense to me to map through the strand using a "complement map" to check relationships.
  • Emgord also solved the problem with a lot of else if statements. It gets the job done and makes sense when reading the code, even though it seems like it needs to be refactored.
  • DanOlson built a really creative solution to the RNA exercise. He used a constant for the complement map and exported a DnaTranscriber class. Easy to read the code and understand its logic.
@rrgayhart
Copy link

Excellent, thanks! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment