Skip to content

Instantly share code, notes, and snippets.

@deborahleehamel
Last active October 12, 2016 13:18
Show Gist options
  • Save deborahleehamel/56dc1ec9dcc6518191015d264b2f29f0 to your computer and use it in GitHub Desktop.
Save deborahleehamel/56dc1ec9dcc6518191015d264b2f29f0 to your computer and use it in GitHub Desktop.

##Leap My code: here

  • Responder #1 (here) - This responder defined new variables for each condition check rather than the if/return I chose.

  • Responder #2 (here) - This person also used the if/return conditionals, but separated the last condition in a separate check.

  • Responder #3 (here) - This user did an explicit check for every condition.

##Hamming My code: here

  • Responder #1 (here) - This user started by initially splitting the strings, but that was not necessary. Another user also commented on this code that it is actually better to use the charAt(int) method since the brackets apparently are not supported in IE7.

  • Responder #2 (here) - This user created completely seperate functions for checks for hasEqualLenght and calculateDiffs. This seems like a lot of extra code. I just did the check for length and error output at the beginning and then ran the character by character comparision loop.

  • Responder #3 (here) - This approach is similar to mine, but they did use the charAt Javascript method to return the character at the specified index in a string.

##RNA Transcription My code: here

  • Responder #1 (here) - This approach is very readable. It uses a Class which I believe is a new "syntactic sugar" that the latest version of JavaScript(ES6) adds on top of the existing prototype-based inheritance. They then set up pretty straight forward replacements for each nucleotide, taking care of the necessary capitalization along the way with toUpperCase.

  • Responder #2 (here) - This user set up a look up for all the nucleotide assignments. I like the look up and didn't think to do that. They also used a different strategy to split up the dna strand and then map over it looking up each character and then joining it back together at the end.

  • Responder #3 (here) - This response is very similar to mine, except they use case and continue for each nucleotide pair replacement.

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