Skip to content

Instantly share code, notes, and snippets.

@vstarck
Created January 24, 2013 17:42
Show Gist options
  • Save vstarck/4625601 to your computer and use it in GitHub Desktop.
Save vstarck/4625601 to your computer and use it in GitHub Desktop.
fizzbuzz.2.js
function fizzBuzz(from, to) {
var text =
'Fizz,,'.split(',')[from%3] +
'Buzz,,,,'.split(',')[from%5]
var _ = {}
_[text] = ''
_[''] = from
console.log(
from, ' -> ', text + _[text]
)
var _next = {}
_next[from] = fizzBuzz
_next[to] = function() {}
_next[from++](from, to)
}
fizzBuzz(1, 20)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment