Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jesse-spevack
Last active November 21, 2016 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jesse-spevack/ce63f3f200420fb7ad62290ec0d69738 to your computer and use it in GitHub Desktop.
Save jesse-spevack/ce63f3f200420fb7ad62290ec0d69738 to your computer and use it in GitHub Desktop.
Jesse Spevack JavaScript Exercism Reflections

##Leap My code: here

  • Responder #1 (here) - This responder used a multi-line if / else statement and did not extract out the 3 modulo operations into a separate function.

  • Responder #2 (here) - This responder used a ternary statement, but unnecessarily included a true / false return.

  • Responder #3 (here) - This user decided to build the logic out with a nested conditional, nesting the %100 and %400 checks within the %4 conditional. It appears cleaner at first glance and the nested structure does mirror the logic of the problem, though I know in a more complex situation a nested conditional could prove to be a real can of worms.

  • Responder #4 (here - This responder used three nested if statements and four different return statements. I don't think this is the most readable approach.

  • Responder #5 (here) - This responder used almost teh same approach that I used. She / he extracted out the modulo function into three separate constants. I've never seen constants used this way and I'm left wondering what the drawbacks / advantages this has over defining a divisible function.

##Hamming My code: here

  • Responder #1 (here) - This responder used the charAt() function.

  • Responder #2 (here) - This responder used a let statement to declare variables. She / he also used a ternary operation to either add 0 or 1. I think it's simpler to add 1 in the case of inputs being unequal as opposed to adding 0 if they are equal and adding 1 if they are not equal.

  • Responder #3 (here) - This user ran the split the strands before checking for length equality.

  • Responder #4 (here - This responder created a class Haming and declared constants of each split strand. She / he also used the reduce function to get the total count of disimilar characters.

  • Responder #5 (here) - This responder took a similar approach to my own. I extracted pieces into separate functions, they did not.

##RNA Transcription My code: here - Unlike the five responders I looked at, I used a hash / dictionary to store the nucleotide conversion. I think this is the best approach because it does not require the use of any conditionals.

  • Responder #1 (here) - This responder used a switch case, but I don't think it will pass the final test of transcribing dna with multiple nucleotides.

  • Responder #2 (here) - This responder two arrays to store the dna to rna transcription code. She / he then used a map function to do the conversion.

  • Responder #3 (here) - This responder used a series of conditional ternary statements within a forEach loop.

  • Responder #4 (here - This responder used a similar approach to #3 except they wrote out the conditionals with if / else if / else and used a traditional for loop.

  • Responder #5 (here) - This responder created a separate function called 'complement' which used a switch case to return a nucleotide's complement nucleoptide. Then she / he ran a for loop on the nucleotide input and called the compliment function on each nucleotide.

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