FizzBuzz in Javascript

A colleague showed me a FizzBuzz question on stackoverflow: http://stackoverflow.com/questions/437/what-is-your-solution-to-the-fizzbuzz-problem/

Inspired by: http://www.codinghorror.com/blog/2007/02/why-cant-programmers-program.html

Sourced from: http://imranontech.com/2007/01/24/using-fizzbuzz-to-find-developers-who-grok-coding/

Here’s my golfed javascript versions which runs in nodejs, YMMV:

Recurvise:
(function(a){console.log(a%3?”":”Fizz”+a%5?”":”Buzz”||a)a++<99||arguments.callee(a)})(0);

For loop:
for(a=0;a++<100;)console.log((a%3?”":”Fizz”)+(a%5?”":”Buzz”)||a)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>