##Leap My code: here
I didn't have any responses to this. I also realized after I submitted that I didn't need the first this.year % 100 = 0
, but I didn't want to iterate my solution.
-
Option #1 (here) - this coder's solution was to create variables inside the function, which seems a little kludgy, but their return statement looks rather elegant. they could have made it more elegant by making
divisibleBy100
intonotDivisibleBy100
, though. -
Option #2 (here) - this solution seems like a bit of a mess. the returns aren't in any semblance of order. their first statement is unnecessary - that
return false
could have been easily returned for theelse
. however, I can see that it is essentially a guard statement - firing off what should be the most common return first avoids running through the entireif
statement every single time. -
Option #3 (here) - this is quite possibly the cleanest solution available for this. without using ugly ternary syntax, they run through all three of the requirements for the function to return
true
in one line of code. pretty clean, and easily readible.