Skip to content

Instantly share code, notes, and snippets.

@Kealii
Last active February 26, 2016 17:26
Show Gist options
  • Save Kealii/7ff52ba9199d44174516 to your computer and use it in GitHub Desktop.
Save Kealii/7ff52ba9199d44174516 to your computer and use it in GitHub Desktop.
Javascript Practice for Turing School Module 4

##Leap My code: here

  • Responder #1 (here) - I like how clean Max kept his code while still being easily readable. The only improvement I could see is using Javascripts' implicit handling of conditionals.

  • Responder #2 (here) - This solution seems strange due to the inclusion of an else that's unnecessary. It's doable to think about, but not instantly obvious what each lines purpose is.

  • Responder #3 (here) - I really like what Tess did here, using nested conditionals to ensure she never explicitly returns false. It's not something I would reach for instantly, but it's a cooler use of logic than explicity stating "if x then y" 3 times over.

  • Responder #4 (here) - This code is functional, and obvious in what it's looking for, but is very verbose and inconsisten with spacing. While the compiler doesn't care, it is definitely distracting to my human eye.

  • Responder #5 (here) - I really like David's approach here as it's the DRYest I've seen yet. It's super cool and 'clever' while still being easy to reason about quickly.

##Hamming My code: here

  • Responder #1 (here) - Here Max definitely was more careful about his code and ensuring he wrapped his methods in the conditional. His error catching is much more thorough by ensuring that everything can either pass successfully through the block or it explicitly throws an error.

  • Responder #2 (here) - This code appears to be short in terms of lines of code by using a Ternary operator, but in terms of readability, it's definitely lacking. That said, I do like to see use of Javascripts built in enumerators because I'm personally not comfortable enough with them to just reach for the right one, even when I know it exists (ala reduce).

  • Responder #3 (here) - All of this code is extremely readable until it gets into the 'if' statement where it takes a few seconds to decipher what's going on. It's cool though to see use of substring to iterate through a collection of characters.

  • Responder #4 (here) - Aside from the unnecessary code that another commentor pointed out, this example is very similar to mine and as such, I find it easy to follow.

  • Responder #5 (here) - This code seems convoluted and busy, but after decoding it a bit, it also seems very powerful and 'clever'. Another commentor noted he could remove all use of variables by simply performing the return function on the 'strand.split.reduce' and then it'd be even MORE clever.

##RNA Transcription My code: here

  • Responder #1 (here) - This was pretty cool as the responder took some time to build 2 separate 'convert' methods and allowed you to specify which one to use. Beyond the scope of the problem but still nice to see. Max also seems to do a lot of error checking and his use of 'in' here is another example of that thoroughness.

  • Responder #2 (here) - This solution is pretty similar to mine with some hilarious naming. As far as functionality goes, the code itself seems pretty obvious and easy to understand, but better naming would go a long way. That said, it certainly didn't seem like a priority for this poster XD

  • Responder #3 (here) - This solution is also similar and for me, easy to read. I do like that he left the RNA map out of the function since there's no reason for it to be within the function.

  • Responder #4 (here) - There are some definite oddities to this solution, namely the use of an underscore and a reduce function that start at "". I'm not versed enough in the use of underscores to understand why you would choose to use it here.

  • Responder #5 (here) - This response confused me the most out of any of them. I'm not sure what the purpose of 'hasOwnProperty' is here unless this was an assignment completed for another problem that was copy pasta'd. One thing I did learn from this was that you could directly export a function without creating it first (though I'm not sure why you'd want to do that here).

@rrgayhart
Copy link

OMG newShit is so not a good name for a function...

..unless....

maybe it's the best?

Great responses here, I enjoy reading this!

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