Skip to content

Instantly share code, notes, and snippets.

@zanedeg
Created January 24, 2016 00:35

Revisions

  1. zanedeg created this gist Jan 24, 2016.
    7 changes: 7 additions & 0 deletions fizzbuzz.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    function fizzbuzz(str, next) {
    var iterVal = next % 3 === 0 ? 'Fizz' : '';
    iterVal += next % 5 === 0 ? 'Buzz' : '';
    str += iterVal ? iterVal : next;
    return next > 99 ? str : fizzbuzz(str + ',', next + 1);
    }
    console.log(fizzbuzz("",1));