Skip to content

Instantly share code, notes, and snippets.

@julsfelic
Created May 14, 2016 15:46
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 julsfelic/e7c31016ab68652cf0092115aac2bb80 to your computer and use it in GitHub Desktop.
Save julsfelic/e7c31016ab68652cf0092115aac2bb80 to your computer and use it in GitHub Desktop.
JavaScript Exercisms

Leap

My code: here

  • Responder #1 here - Does not make use of the ES6 features like the class keyword. I do like how he broke up into readable variables. Overall a pretty clean solution.
  • Responder #2 here - As the above responder, does not make use of ES6 features. The logic is kind of confusing due to the many nested if / else if / else statements. Could use a refactor for better clarity.
  • Responder #3 here - No use of ES6, but this is the cleanest solution I have run across yet! A very simple inline statement that is not hard to read. Good use of a "guard" condition.
  • Responder #4 here - Slight variation from respnonder #4. Insetad of having a guard statement all of the conditions are within the single if statement. Not a bad solution, but the if could get a little hard to read if there were any more statements added.
  • Responder #5 here - This is almost an exact replica of what I did. Only difference is they did not use ES6.

Hamming

My code: here

  • Responder #1 here - Does not use ES6. Did not know you can pass a string into the Error constructor. And using a for loop probably yields better performance. Overall a pretty clean implementation, would like to see the error handling put into its own method.
  • Responder #2 here - Does not use ES6. This solution is kind of all over the place. Not sure why they use this withing the method. Would like to see the error handling within its own method. The loop has an unecessary count += 0 line that could be refactored out.
  • Responder #3 here - Does not use ES6. This is a very interesting solution! Instead of creating a constructor they are using a singleton object which is pretty cool. The method is a little weird in the way the error handling is nested within it. Overall a clever solution.
  • Responder #4 here - Does not use ES6. Par for the course. Does have some weird indentation but very similar solution across the board.
  • Responder #5 here - Does not use ES6. Does not use the prototype pattern for adding the compute method, which is not a big deal for this instance, but would be beneficial to add it to the prototype instead of the Constructor. Same critiques as the others about breaking out error handling into its own method.

Rna Transcription

My code: here

  • Responder #1 here - Does not use ES6. Nice use of map, would like to see the use of a object for mapping Dna to Rna. Overall pretty clean.
  • Responder #2 here - Does not use ES6. Use of a for loop is always nice for performance. Totally forgot about charAt so that is nice. Use of switch is different, would still prefere to see an object used for mapping.
  • Responder #3 here - Does not use ES6. On the right track with using an object for mapping! I would move the object thought to the constructor. Not sure about the reassignment of dna. Not sure how I feel about having a function defined within toRna instead of on the prototype. Overall on the right track.
  • Responder #4 here - Does not use ES6. Does not use a constructor, which works but feels a little eh. Uses a object for mapping. The indentation is really weird and defining a function within a function is still really odd. Would like to see a more OO approach to the problem.
  • Responder #5 here - Does not use ES6. I like that they broke up the component parts into sepearte functions. Would like to see a object instead of a long if / else if / else structure. Overall a clean implementation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment