Skip to content

Instantly share code, notes, and snippets.

@vstarck
Last active December 11, 2015 14:18
Show Gist options
  • Save vstarck/4613064 to your computer and use it in GitHub Desktop.
Save vstarck/4613064 to your computer and use it in GitHub Desktop.
FizzBuzz without conditional / boolean operators / trycatch / etc
function fizzBuzz(from, to) {
function print() {
var text =
',,Fizz'.split(',')[from%3] +
',,,,Buzz'.split(',')[from%5]
var _ = {}
_[text] = ''
_[''] = from
console.log(
text + _[text]
)
}
function loop() {
var _ = []
_[from] = loop
_[to] = function() {}
print()
_[from++]()
}
loop()
}
fizzBuzz(1, 20)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment