rmurphey/js-assessment-answers — pull request #8 by craveytrain (2012-12-13 19:41:49+00:00)
Title: Checks for typeof number

I also adjusted the flow slightly. It doesn't check for modulus of 3 and 5 twice. I tried to avoid getting too cute (banging the output of the modulus instead of comparing it to 0) yet still do things javascript-y (checking for the truthiness of the string at the bottom in the return). I also tried to be consistent with established style but if I missed something, I would be happy to adjust.

One thing I wanted to ask about, I considered going all Postel and attempting to parse the passed in number in case it was a string or something. However, I ended up thinking if I did that in real code that could actually hide an issue in my invocation. Felt like that made it a bit of an anti-pattern but I'm absolutely open to adjust the answer (and adding additional tests) to handle that.