Skip to content

Instantly share code, notes, and snippets.

@weilandia
Last active May 8, 2016 22:12
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 weilandia/437de606ddf91ebf4b2139a41e3196c0 to your computer and use it in GitHub Desktop.
Save weilandia/437de606ddf91ebf4b2139a41e3196c0 to your computer and use it in GitHub Desktop.

##Gigasecond My code: here

  • Alt Solution #1 (here) - This solution makes some interesting decisions that I'm not sure I agree with. They define Gigasecond, then use.prototype.date to return the solution. These could be merged into one function/constructor.

  • Alt Solution #2 (here) - This solution is pretty similar to mine, except it doesn't use exponents to decreate the gigasecond and it uses an extra line to define a variable called birthday.

  • Alt Solution #3 (here) - This solution is very similar to Alt Solution #1. I like about they used 10e11 instead of pow to define the gigasecond.

  • Alt Solution #4 (here) - This solution is interesting for a few reasons. First, they use the "class" definition which I think is pretty new. Second, they export the class/function directly. Third, they define the constructor explicitly.

  • Alt Solution #5 (here) - This solution is interesting in that they used a constant to defind the gigasecond. They also used a class with an explicit constructor and used date() and a method rather than an attribute.

##Bob My code: here

  • Alt Solution #1 (here) - This solution has very similar logic, but user multiple if statements with explicit returns rather than using if/else statements.

  • Alt Solution #2 (here) - This solution made an attempt at drying up the code by extracting conditional logic into methods, but I don't think this would have been necessary if the logic was made more concise. The resulting solution is much longer than it needs to be.

  • Alt Solution #3 (here) - This logic in this solution is very similar but he made the mistake of splitting the string, which isn't necessary.

  • Alt Solution #4 (here) - Again, very similar logic, but the solution uses .endsWith(), which is cool.

  • Alt Solution #5 (here) - I don't like this solution. First, functions are defined upfront for isQuestion and isShouting, which I don't think is particularly usefule. Also, the logic is managed by multiple if statements instead of if/else statements.

##Pangram My code: here

  • Alt Solution #1 (here) - Erinna's solution has an interesting difference in that it build a string to determine uniqueness instead of building an array and evaluates equality against a sorted alphabet. I think her solution is more performant, but I would like to discuss to confirm.

  • Alt Solution #2 (here) - This solution the alphabet as an object with letters as keys and integers (0) as their values. My first reaction was that I didn't like the solution because it was verbose, but it avoids having to do a loop to determine uniqueness and is likely more performant.

  • Alt Solution #3 (here) - This solution uses the same logic as my solution to determine uniqueness, checking to see if indexOf is less than 0, and the solution is much shorter, but at the expense of readability. Though, the logic is not complex so this may be sufficiently readable.

  • Alt Solution #4 (here) - I like this solution a lot, but it's using ECMAScript syntax (Set) to identify uniqueness. Cheating, but brings up a great question about whether it's useful to learn JS with things like Babel converting ECMAScript to JS for browsers that aren't ready.

  • Alt Solution #5 (here) - This solution is nice and clear, but it defines a couple methods in the global scope that should probably be defined directly on an instance of Prototype.

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