Created
August 27, 2014 08:42
-
-
Save chrislaughlin/2897c6e467e00f3c1c91 to your computer and use it in GitHub Desktop.
fizz module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(root, module) { | |
if (typeof exports == 'object') { | |
module.exports = module(); | |
} else if (typeof define == 'function' && define.amd) { | |
define(module); | |
} else { | |
root.Fizzbuzz = module(); | |
} | |
}(this, function () { | |
var FIZZ_NUMBER = 3; | |
var BUZZ_NUMBER = 5; | |
function play(number) { | |
if (number.isDivisibleBy(FIZZ_NUMBER)) { | |
return "Fizz"; | |
} | |
if (number.isDivisibleBy(BUZZ_NUMBER)) { | |
return "Buzz"; | |
} | |
return number; | |
}; | |
return { | |
play: play | |
}; | |
}(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment