- Solution 1 - This person used an if/else statement to return true or false. It's actually unnecessary since the logical expression itself will return true or false. They could remove that and get rid of some lines of code.
- Solution 2 - This person did the same thing as solution 1. I also think they could refactor to pull out the logical statement into its own function to clean up the code.
- Solution 3 - This person had an interesting approach to the code by creating
divisible
variables to help the reader understand what is going on in the logical expression. I actually like this a lot as I think it makes it easier to read and cleans up the logical expression. However they could simplify line 8 by regrouping the logical expressions. - Solution 4 - This person clearly understood that the logical expression itself will return true or false, and thus left off the explicit if/else that the first two people used.
- Solution 5 - I'm not actually sure that this solution passes any tests, because they didn't even declare an
isLeap
function. I think this person had the correct idea for what to do to solve the problem, but they weren't using TDD to realize that their solution would fail all of the tests since the tests explicitly callisLeap
.
- Solution 1 - This solution seems unnecessarily long and complex to me. For instance, they use the slice method to slice off each letter one at a time instead of just indexing through the string. They also made
countLikeCharacters
into a recursive method, which again, seems more complex than needed. - Solution 2 - This solution looks fairly similar to mine, except they used
charAt
instead of the bracket notation for walking through the string. I think bracket notation is simpler/more common. - Solution 3 - This solution seems to declare unnecessary seq1 and seq2 variables instead of passing the split variables directly into the distance function. Overall the code is pretty clean and to the point though.
- Solution 4 - This solution looks very similar to mine. I don't think you actually need to specify
new Error
afterthrow
though. - Solution 5 - This person makes an unnecessary declaration of the variable
strand_length
instead of just calling the length function directly in the for loop declaration. Overall though their code is very similar to mine.
- Solution 1 - This solution also uses a variable to map between the different letters, but uses th
map
function to go through the string to create the new one. It's a neat way to do it without using a for loop, but it's a little less clear what is going on. - Solution 2 - This solution used the
filter
function along with nested if statements to go through and make the rna string. I don't really like using nested if statements if I can avoid it, so I think this could have been shortened somehow. - Solution 3 - This solution is pretty much exactly what I did, using a data map and a for loop to construct the new string.
- Solution 4 - Also very similar to my solution except it looks like they used all capital letters to describe the letter map as a constant. This looks very ruby like to me, I didn't know there were constants in JavaScript.
- Solution 5 - Instead of using a map, this person used multiple if/else statements to concatenate new letters onto the rna string. I like the idea of having a variable/object that is a map instead because it cuts down on the lines of code needed.