Skip to content

Instantly share code, notes, and snippets.

@marlomajor
Created March 26, 2016 19:14
Show Gist options
  • Save marlomajor/384d46a5032ac6f2701e to your computer and use it in GitHub Desktop.
Save marlomajor/384d46a5032ac6f2701e to your computer and use it in GitHub Desktop.
Exercisms

##Leap My code: here

  • Responder #1 (here) - This approach is significantly more simple than mine. The creater uses a one line function that includes an or/and operator and returns true.
  • Responder #2 (here) - This programmer assigns an anonymous function to a variable. Afterwards, she uses an if/elseif/else statement to check for each occurence.
  • Responder #3 (here) - This programmer also used an if else statement to accomplish the same task. Main difference is that the first statement is a check to make sure the year is divisible by 4. The nested if statement then checks for the other functionality.
  • Responder #4 (here) - This programmer uses one if statement to check for divisibility by 4, and afterwards, in one line, checks for all other values.
  • Responder #5 (here) - This programmer uses the same logic I did. Setting this in the initially declared function and creating an isLeap prototype method.

##Hamming My code: here

  • Responder #1 (here) - This programmer sets an anonymous function to a compute: method which is interesting. He then proceeds to build a counter that detects whether the index of rna and dna are equal, after which he returns counter, or throws an error if strands are unequal length.
  • Responder #2 (here) - This programmers code is significantly shorter and less complex than mine. He performs the same compute: function that the above programmer does. This is also an eye opening way of building this compute method.
  • Responder #3 (here) - This programmer has an interesting use of substring where she takes the index to index plus one of each string and returns whether they match or not.
  • Responder #4 (here) - This approach is interesting because it showed me that a string can be accessed by indexed. Splitting a string is not necessary in JS.
  • Responder #5 (here) - Super interesting way of creating this method. User declares a function that does "the thing" and in the end writes a separate anonymous function that computes the values.

##RNA Transcription My code: here

  • Responder #1 (here) - This implementation is almost identical to mine except this programmer uses .map then .join() to implement the same logic.
  • Responder #2 (here) - This user also implements via the joins and map functions. The code is cleanest and easiest for me to understand.
  • Responder #3 (here) - This is the cleanest by far of all of the previous implementations. User uses split and rnaMap interestingly.
  • Responder #4 (here) - This is the most complicated of the implentations. Reduce is used then rna and the string is itnerpolated.
  • Responder #5 (here) - This is the longest of the above methods and one of the more complex. It seems as though the programmer was successful at breaking the thoughts into smaller arguments, but unsucessful in refactoring. Also, module.exports being used on a function is something I've never seen before.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment