Skip to content

Instantly share code, notes, and snippets.

@satokitty
Forked from kazuho/fizzbuzz.js
Created August 9, 2012 16:03
Show Gist options
  • Save satokitty/3305435 to your computer and use it in GitHub Desktop.
Save satokitty/3305435 to your computer and use it in GitHub Desktop.
// 指定した値まで表示するように変更
// fizzbuzz(15) -> 1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz
fizz = function f() {
fizz = function() {
fizz = function() {
fizz = f
return "Fizz"
}
}
}
buzz = function f() {
buzz = function() {
buzz = function() {
buzz = function () {
buzz = function () {
buzz = f
return "Buzz"
}
}
}
}
}
fizzbuzz = function(n) {
n == 1 || fizzbuzz(n-1)
console.log((fizz() || "") + (buzz() || "") || n)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment