Skip to content

Instantly share code, notes, and snippets.

@theonlyrao
Last active June 22, 2016 18:40
Show Gist options
  • Save theonlyrao/c9e02204599ab85d064f8b800db120d5 to your computer and use it in GitHub Desktop.
Save theonlyrao/c9e02204599ab85d064f8b800db120d5 to your computer and use it in GitHub Desktop.
JS exercism report

##Hello World My code: here

  • Responder #1 (here) - This response is an implementation that I was wondering how to do because it handles a nil value for input as a way of defaulting to "World" instead of a name.
  • Responder #2 (here) - This response is essentially the same as my implementation, but uses a ternary operator for the if/else that I broke out. I find it much harder to read as a ternary.
  • Responder #3 (here) - This response also uses a ternary, but within the return block so that if there is an input it gets used, but if there isn't then "World" is returned. I like this better than #2 but still don't like it very much because it seems weird to be evaluating the input within the return block instead of first determining what has been input and then presenting the output later.
  • Responder #4 (here) - This implements the validation of the input using a kind of guard. This along with the others also shows me that I don't need to use the .length method on the input - javascript will return a falsey value for just input if nothing is there.
  • Responder #5(here) - Like an earlier one, this uses a || operator to determine whether to use the input or "World" in the return string. I think I like this one the best because it cleanly handles the parsing of the input in a separate variable that then gets sent to the output.

##Leap My code: here

  • Responder #1 (here) - This response has the benefit of being very few lines of code but I find it pretty hard to read. I'm also not sure about whether it is good or bad to instantiate the object and use an object method or to use the prototype pattern from the hello world exercism.
  • Responder #2 (here) - This response uses the same nested || statements to evaluate the year, which I find hard to read.
  • Responder #3 (here) - This response breaks out the nestedness a little bit but actually might be even harder to read. However, I have learned that I should have just let the modulo expressions return the true or false values for themselves.
  • Responder #4 (here) - This response is almost identical to mine.
  • Responder #5(here) - This response breaks each step of evaluation (divisible by 400, 100, and 4) into a different line like mine but then doesn't use any else if statements, which seems like it might be a little weird.

##Hamming My code: here

  • Responder #1 (here) - This response uses a very similar approach with slightly different implementation. I like the fact that this person doesn't bother turing the DNA string representation into an array before iterating through it - that's good to know. I do think it is better to break the actual calculation of the differences into a separate function instead of having it done all at once.
  • Responder #2 (here) - This response has the same basic logic but is too convoluted, nesting the iteration over the strings inside an else statement.
  • Responder #3 (here) - This response did it almost the same way as me, except again didn't break the calculation into its own function.
  • Responder #4 (here) - Same basic logic, but even more terse. It's like the user tried to delete anything that wasn't absolutely necessary to get the code to work. I just don't see the point of that.
  • Responder #5 (here) - Again, same logic but I don't understand how the error message actually appears properly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment