Skip to content

Instantly share code, notes, and snippets.

@chrislaughlin
Created August 27, 2014 08:42
Show Gist options
  • Save chrislaughlin/2897c6e467e00f3c1c91 to your computer and use it in GitHub Desktop.
Save chrislaughlin/2897c6e467e00f3c1c91 to your computer and use it in GitHub Desktop.
fizz module
(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