Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
FizzBuzz JavaScript solution
for (var i=1; i <= 20; i++)
{
if (i % 15 == 0)
console.log("FizzBuzz");
else if (i % 3 == 0)
console.log("Fizz");
else if (i % 5 == 0)
console.log("Buzz");
else
console.log(i);
}
@paulirish

This comment has been minimized.

Copy link

commented Mar 5, 2013

for (var i = 1; i <= 100; i++) {
  var f = i % 3 == 0, b = i % 5 == 0;
  console.log(f ? b ? "FizzBuzz" : "Fizz" : b ? "Buzz" : i);
}
@Alexander-0x80

This comment has been minimized.

Copy link

commented Jul 18, 2013

for(var i=1;i<=100;i++, msg=""){
    if (!(i%3)) msg+="Fizz"; 
    if (!(i%5)) msg+="Buzz"; 
    console.log(msg || i); 
}
@giladaya

This comment has been minimized.

Copy link

commented Jul 18, 2013

// http://en.wikipedia.org/wiki/Precomputation
var vals = [1, 2, "Fizz", 4, "Buzz", "Fizz", 7, 8, "Fizz", "Buzz", 11, "Fizz", 13, 14, "FizzBuzz", 16, 17, "Fizz", 19, "Buzz", "Fizz", 22, 23, "Fizz", "Buzz", 26, "Fizz", 28, 29, "FizzBuzz", 31, 32, "Fizz", 34, "Buzz", "Fizz", 37, 38, "Fizz", "Buzz", 41, "Fizz", 43, 44, "FizzBuzz", 46, 47, "Fizz", 49, "Buzz", "Fizz", 52, 53, "Fizz", "Buzz", 56, "Fizz", 58, 59, "FizzBuzz", 61, 62, "Fizz", 64, "Buzz", "Fizz", 67, 68, "Fizz", "Buzz", 71, "Fizz", 73, 74, "FizzBuzz", 76, 77, "Fizz", 79, "Buzz", "Fizz", 82, 83, "Fizz", "Buzz", 86, "Fizz", 88, 89, "FizzBuzz", 91, 92, "Fizz", 94, "Buzz", "Fizz", 97, 98, "Fizz", "Buzz"];
for(var i=1, len=res.length; i<len; i++){
  console.log(res[i]);
}
@mobz

This comment has been minimized.

Copy link

commented Aug 8, 2013

// smallest?
for(i=0;i<100;)console.log((++i%3?'':'Fizz')+(i%5?'':'Buzz')||i)
@rhka

This comment has been minimized.

Copy link

commented Jul 27, 2014

Excellent guys!

really smallest mobz :)

@thetwit4u

This comment has been minimized.

Copy link

commented Jan 7, 2015

// And this the fastest ;) Even versus the precomputed.
// http://jsperf.com/fizzbuzz-arraymapvsprecomputevsforv3

console.log(
Array.apply(0, Array(100)).map(function (x, y) {
var nb = y+1;
var isFizz = ((nb % 3) == 0);
var isBuzz = ((nb % 5) == 0);
var isFizzBuzz = (isFizz && isBuzz);
if (isFizzBuzz) return 'fizzbuzz';
if (isFizz) return 'fizz';
if (isBuzz) return 'buzz';
return(nb);
}).join("\n"));

@SeeThruHead

This comment has been minimized.

Copy link

commented Jan 20, 2015

console.log(
  Array.apply(null, {length: 100}).map(function(val, index) {
    return (++index%3?'':'Fizz')+(index%5?'':'Buzz')||index;
  }).join('\n')
);

Faster?

console.log(
  Array.apply(null, {length: 100}).map(function(val, index) {
    index++;
    if (index % 15 == 0){return "FizzBuzz";}
    if (index % 3 == 0){return "Fizz";}
    if (index % 5 == 0){return "Buzz";}
    return index;
  }).join('\n')
);
@angvishvish

This comment has been minimized.

Copy link

commented Feb 20, 2015

var check = function (number) {
      var fizz = number % 3 == 0, buzz = number % 5 == 0;
      console.log(fizz ? buzz ? "FizzBuzz" : "Fizz" : buzz ? "Buzz" : number);
      if (number != 0) { return check(number - 1);}
} check(100);
@dstop75

This comment has been minimized.

Copy link

commented Feb 22, 2015

var i, values = [, , 'fizz', , 'buzz', 'fizz', , , 'fizz', 'buzz', , 'fizz', , , 'fizzbuzz'];

for (i = 0; i < 100; console.log(values[i++ % 15] || i));
@fernandocamargo

This comment has been minimized.

Copy link

commented Mar 1, 2015

(function (window) {
    'use strict';
    var counter = 1;
    var limit = 100;
    var options = {
      3: 'Fizz',
      5: 'Buzz',
      'default': function (input) {
        return input;
      }
    };

    var noop = function () {
      return;
    };

    var print = function (input) {
      var output = [];
      Object.keys(options).map(
        function (key) {
          (((typeof options[key] !== 'function') && ((parseInt(input, 10) % parseInt(key, 10)) === 0)) ? Array.prototype.push : noop).call(output, options[key]);
        }
      );
      return console.log.call(console, output.length ? output.join('') : options.default.call(this, input));
    };

    for (; counter <= limit; counter += 1) {
      print.call(this, counter);
    }
})(this);
@soundyogi

This comment has been minimized.

Copy link

commented Mar 5, 2015

Not short or fast or anything special ... but I think it's pretty <3

(function fizzBuzz(iter){
    var str = '';


    if(!(iter % 3)) str += 'Fizz'
    if(!(iter % 5)) str += 'Buzz'


    console.log(str || iter)


    if(iter >= 100) return


    fizzBuzz(++iter)
})(1)
@arei

This comment has been minimized.

Copy link

commented Mar 9, 2015

for (var i=0;i<=100;i++) console.log(!(i%15)&&"fizzbuzz"||!(i%5)&&"buzz"||!(i%3)&&"fizz"||i);

@dotch

This comment has been minimized.

Copy link

commented Mar 14, 2015

// even shorter
for(i=0;++i<101;console.log(i%5?x||i:x+'Buzz'))x=i%3?'':'Fizz'
@AdrianVelazquez

This comment has been minimized.

Copy link

commented Mar 27, 2015

for(i = 0; i <= 20; i++){
if(i % 3 == 0 && i % 5 == 0){
console.log("fizzBuzz");
}else if(i % 3 == 0){
console.log("fizz");
}else if(i % 5 == 0){
console.log("buzz");
}else{
console.log(i);
};

};

@sintaxi

This comment has been minimized.

Copy link

commented May 12, 2015

felt obligated to contribute...

for (var i=1; i<=100; i++)(function(i){
  var output = ""

  if (i % 3 == 0)
   output += "Fizz"

  if (i % 5 == 0)
   output += "Buzz"

  console.log(output || i)
})(i)
@cornedor

This comment has been minimized.

Copy link

commented May 12, 2015

Using a Generator

function * fizzBuzz() {

    var i = 0;
    while (true) {
        ++i;
        var x = 0;
        if (i % 3 === 0 && i % 5 === 0) yield 'Fizz Buzz';
        else if (i % 3 === 0) yield 'Fizz';
        else if (i % 5 === 0) yield 'Buzz';
        else yield i;
    }

}

var gen = fizzBuzz();
for (var i = 0; i < 100; i++) {
    console.log(gen.next().value + ' ');
}
@grabbou

This comment has been minimized.

Copy link

commented May 12, 2015

var fizzBuzz = function* () {
    var i = 0;
    do {
      const isFizz = i % 3 === 0;
      const isBuzz = i % 5 === 0;
      yield (isFizz ? isBuzz ? "FizzBuzz" : "Fizz" : isBuzz ? "Buzz" : i);
    } while (++i)
  }

var it = fizzBuzz();

for (let i = 0; i < 100; i++){
  console.log(it.next().value);
}
@technowar

This comment has been minimized.

Copy link

commented May 13, 2015

(function (){
    var array = [];

    for (var i = 1; i <= 100; i++) {
        array.push(i);

        if (i % 3 === 0) {
            array.splice(i - 1, 1, 'Fizz');
        }

        if (i % 5 === 0) {
            array.splice(i - 1, 1, 'Buzz');
        }

        if (i % 15 === 0) {
            array.splice(i - 1, 1, 'FizzBuzz');
        }
    }

    console.log(array);
})();
@0xadada

This comment has been minimized.

Copy link

commented May 13, 2015

// Concise
var f='Fizz', b='Buzz', i=0, d3, d5;
for (i; ++i <= 100; d3 = !(i % 3), d5 = !(i % 5), console.log(d3 ? d5 ? f+b : f : d5 ? b : i));

// Multi-line, commented
var               /* Declare our variables outside the loop, a performance best-practice */
    f='Fizz',     /* Variable `f` so we don't repeat 'Fizz' twice - DRY */
    b='Buzz',     /* Variable `b` so we don't repeat 'Buzz' twice - DRY */
    i=0,          /* For-loop counter, start at 0 */
    d3,           /* setup a variable for checking divisibility by 3 */
    d5;           /* setup a variable for checking divisibility by 5 */
for (                 /* Bodyless for loop */
    i;                /* Iterator on i */
    ++i <= 100;       /* ++i pre-increments to 1, stops at 100 */
    d3 = !(i % 3),    /* Logically we're testing for i%3 === 0 to be TRUE, indicating
                       * i is divisible by 3. Instead we test for 0, which also
                       * represents FALSE in Javascript. Use the ! NOT operator
                       * to coerce 0 to boolean value 1- which is TRUE. */
    d5 = !(i % 5),    /* Testing that NOT (i % 5) is TRUE using same logic as above */
    console.log(      /* ouput the result of a ternary operation to the console */
        d3 ?          /* was i divisible by 3? */
            d5 ?      /* was i divisible by 5? *? */
                f+b : /* Both conditions d3 and d5 are divisible TRUE: return string 'FizzBuzz': else */
            f :       /* only !(i%3) is true, just return string 'Fizz' */
        d5 ?          /* BOTH 3 AND 5 weren't divisible, was 5 divisible by itself TRUE? */
        b :           /* yes, return 'Buzz' */
        i             /* Nope, just return i */
    )                 /* end of console.log */
);                    /* end of for-loop */
@adamjgrant

This comment has been minimized.

Copy link

commented May 13, 2015

Shortest! And it doesn't print numbers when not divisible by 5 or 3 per the requirements.

x=0;while(x++<100)console.log((x%3?"":"fizz")+(x%5?"":"buzz"))

(62 characters)

http://codepen.io/ajkochanowicz/pen/XbdaaM

And if a "fizz buzz" format is acceptable you could do this

x=0;while(x++<100)console.log(x%3?"":"fizz",x%5?"":"buzz")

(58 characters)

@adamjgrant

This comment has been minimized.

Copy link

commented May 14, 2015

Make that 61 characters...

for(x=0;x++<100;)console.log((x%3?"":"fizz")+(x%5?"":"buzz"))

or 57 characters...

for(x=0;x++<100;)console.log(x%3?"":"fizz",x%5?"":"buzz")

And if we're allowed to print numbers instead of ""

for(x=0;x++<100;)console.log(x%3||"fizz",x%5||"buzz")

(53 characters)

@AlexFoster009

This comment has been minimized.

Copy link

commented May 29, 2015

This might seem like a dumb question, but how would i append the result of the loop to the body element of the page?

my markup

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Fizz Buzz Challenge</title>
    <script src="http://code.jquery.com/jquery-2.1.4.min.js"> </script>
    <script src="script.js"> </script>
</head>
<body>





</body>
</html>

the script

var i;


for( i = 1; i <= 100; i++){


    if (  i % 15 == 0) {

        console.log('Fizz Buzz')

    }else if (i % 5 == 0) {

        console.log('buzz');

    }else if (i % 3 == 0) {



        console.log('Fizz');


    }else {


        console.log(i);
    }





}



Instead of console.log id like to have my results print into the body element so it is displayed on the page rather then in the console...its probably simple but im brand new to programming

@tedgeving

This comment has been minimized.

Copy link

commented Jun 10, 2015

Below will append to the body, would need to use a query selector to place it somewhere specific.

Alternatively, results are appended to a div instead of body in this fiddle: https://jsfiddle.net/frpmz5jr/

for(var i = 1; i <=100; ++i){

 if(i % 15 === 0){

        // console.log('Fizz Buzz');
        document.write('Fizz Buzz');
        document.write('<br/>');

    }else if(i % 3 === 0){

        // console.log('Fizz');
        document.write('Fizz');
        document.write('<br/>');

    }else if(i % 5 === 0){

        // console.log('Buzz');
        document.write('Buzz');
        document.write('<br/>');

    }else{

        // console.log(i);
        document.write(i);
        document.write('<br/>');
    }
}

@omeiza

This comment has been minimized.

Copy link

commented Jul 4, 2015

I feel this is the most simplest and the best solution.

for (var i = 1; i <= 100; i++) { answer = " "; if (i % 3 == 0) { answer += 'Fizz'; } if (i % 5 == 0) { answer += 'Buzz'; } console.log(answer || i); }
@vrybas

This comment has been minimized.

Copy link

commented Jul 5, 2015

  1. Readability
  2. Readability
  3. Readability
  4. Extendability
  5. Performance
    ...
  6. Counting of LOC
FizzBuzz = function() {
  var length = 100,
      result = new Array(length);

  for (i=0; i < length; i++) {
    var seqNum     = i + 1,
        div3       = ((seqNum % 3) === 0),
        div5       = ((seqNum % 5) === 0),

        isFizzy    = div3,
        isBuzzy    = !div3 && div5,
        isFizBuzzy = div3 && div5,

        word;

    if (isFizzy)    { word = "Fizz" };
    if (isBuzzy)    { word = "Buzz" };
    if (isFizBuzzy) { word = "FizzBuzz" };

    result[i] = word || seqNum;
    word = null;
  }

  return result;
}

FizzBuzz().forEach( function(elm) { console.log(elm) });
@Azimoto9

This comment has been minimized.

Copy link

commented Jul 13, 2015

var fizz = 'Fizz';
var buzz = 'Buzz';

var fizzbuzz5 = function(j) {
if(j % 5 === 0) {
console.log(fizz + buzz);
}
else {
console.log(fizz);
}};

var fizzbuzz3 = function(k) {
if(k % 3 === 0) {
console.log(fizz + buzz);
}
else {
console.log(buzz);
};

};
for(i=1; i <= 100; i++) {

if(i % 3 === 0) {
    fizzbuzz5(i);
}
else if(i % 5 === 0) {
    fizzbuzz3(i);
}
else {
    console.log(i);
};

};

@wiafe

This comment has been minimized.

Copy link

commented Jul 15, 2015

Here is mine!

for (var i = 1; i <= 100; i++) {
  if (i % 3 === 0) {
      console.log( i + " = " + "Fizz");
  }else if (i % 5 === 0) {
      console.log( i + " = " + "Buzz");
  }else {
      console.log(i);
  }
  if (i % 3 === 0 && i % 5 === 0) {
      console.log( i + " = " + "FizzBuzz");
  }
};
@jw56578

This comment has been minimized.

Copy link

commented Jul 28, 2015


var func = null;
var conditions = {
    1:{true:null,
       false:function(i){
           return function(){console.log(i)};
       }},
    3:{true:function(){
        return func;
    },false:function(){
    return function(){console.log('fizz')};
    }},
    5:{true:function(){ return func;},false:function(){
        return function(){console.log('buzz')};
    }},
    15:{true:function(){ return func;},false:function(){
        return function(){console.log('fizzbuzz')};
    }}

}
var l = 100;
var words = [];
for(l = 1 ; l < 100 ; l ++){    
    for(var thing in conditions){
        var result = l % thing;
        func = conditions[thing][!!result](l);
    }
    func();
}
@ghost

This comment has been minimized.

Copy link

commented Aug 12, 2015

for(var i = 1;i <= 100;i++){
if(i % 3 == 0) {console.log("Fizz");continue;}
if(i % 5 == 0) {console.log("Buzz");continue;}
if(i % 15 == 0) {console.log("FizzBuzz");continue;}
console.log(i);
}

@ogur

This comment has been minimized.

Copy link

commented Aug 25, 2015

Object.keys(new Int8Array(100))
.map(x=>((++x%3==0)?f='fizz':x))
.map((x,i)=>((++i%5==0)?b='buzz':x))
.map((x,i)=>((++i%15===0)?f+b:x))
@amahar

This comment has been minimized.

Copy link

commented Aug 27, 2015

for (var i=1; i < 100; i++){
var message = i; 
if (i%3 == 0 && i%5 == 0){`
    message = "FizzBuzz";
 } else if(i%5 == 0){
    message = "Buzz";
 } else if (i%3 == 0){
    message = "Fizz";
 }
 console.log('\n' + message + '\n');    
 };
@newshorts

This comment has been minimized.

Copy link

commented Aug 28, 2015

if we are going to make things completely unreadable:

for(var i=1;100>=i;++i)console.log(i%15!==0?i%5!==0?i%3===0?"fizz":i:"buzz":"fizzbuzz");
@thomasmarren

This comment has been minimized.

Copy link

commented Sep 1, 2015

Tried to make it using a recursive function

function fizzBuzz(num){
    if (num % 3 === 0 && num % 5 === 0 ){
    console.log("FizzBuzz");
  } else if (num % 3 === 0) {
    console.log("Fizz");
  } else if (num % 5 === 0){
    console.log("Buzz");
  } else {
    console.log(num);
  }

  if (num < 100){
  var newNumber = num + 1;
  fizzBuzz(newNumber);
  }
};

fizzBuzz(1);
@barry-hall

This comment has been minimized.

Copy link

commented Sep 3, 2015

function fizzBuzz(range) {
    for(var i = 0; i <= range; i++) {
        var fizz = Boolean = i % 3 == 0;
        var buzz = Boolean = i % 5 == 0;

        if(fizz && buzz)
            console.log("fizzbuzz");
        else if(fizz)
            console.log("fizz");
        else if(buzz)
            console.log("buzz");
        else 
            console.log(i);
    }
} 

fizzBuzz(100); 
@markogresak

This comment has been minimized.

Copy link

commented Sep 13, 2015

  • "1 sloc" (single chained statement)
  • no ifs and no ternary (some short circuiting "magic")
console.log(
  Array.apply(undefined, {length: 20})
    .map(function(_i, i) { 
      return ((++i % 3 === 0 && 'Fizz' || '') + (i % 5 === 0 && 'Buzz' || '')) || i
    })
    .join('\n')
)

Outer brackets at return could be removed but I decided to keep them for at least some readability.

@ghost

This comment has been minimized.

Copy link

commented Oct 11, 2015

for(var i = 1;i <= 100;i++){
var str = "";
if(!(i%3))str += "Fizz";
if(!(i%5))str += "Buzz";
console.log(str || i);
}

@gridmechanic

This comment has been minimized.

Copy link

commented Nov 18, 2015

(function fizzBuzz () {
    for (i=1;i<101;i++){
        if (i % 15 === 0){
            console.log('FizzBuzz');
        } else if(i % 3 === 0) {
            console.log('Fizz');
        } else if (i % 5 === 0  ){
            console.log('Buzz');
        }
        else {
            console.log(i);
        }
    };
})();
@jaichandra

This comment has been minimized.

Copy link

commented Nov 19, 2015

for(var i=1; i<=15; i++) {
  console.log(i%3 ? i%5 ? i : 'buzz' : i%5 ? 'fizz' : 'fizzbuzz');
}
@nathanhornby

This comment has been minimized.

Copy link

commented Dec 5, 2015

My take, balancing readability with brevity!

for ( i=1; i<=100; i++ ) {
  var mod3   = i%3 === 0,
      mod5   = i%5 === 0,
      result = mod3 && mod5 ? 'fizzbuzz' : mod3 ? 'fizz' : mod5 ? 'buzz' : i;

  console.log( result );
}
@emaraosman

This comment has been minimized.

Copy link

commented Dec 12, 2015

Here's a long one using while:

var counter = 0
while (counter<100){
    counter=counter+1;
    if (counter%3==0 && counter%5==0)
        console.log("FizzBuzz");
    else if(counter%3==0)
        console.log("Fizz");
    else if(counter%5==0)
        console.log("Buzz");
    else
    console.log(counter);
}
@low-ghost

This comment has been minimized.

Copy link

commented Dec 16, 2015

ES7 array comprehension:

console.log(
  [ for (i of Array(100).keys())
    (++i % 3 ? '' : 'fizz') + (i % 5 ? '' : 'buzz') || i ].join('\n'));
@PHRENESE

This comment has been minimized.

Copy link

commented Jan 7, 2016

Conscientious beginner:

function fizzbuzz(num, fizz, buzz) {    
 for (i = 1; i <= num; i++) {    
     if (i % (fizz * buzz) === 0) {
         console.log("FizzBuzz");
     } else if (i % buzz === 0) {
         console.log("Buzz");
     } else if (i % fizz === 0) {
         console.log("Fizz");
     }   
 }  
}    

fizzbuzz(100, 3, 5);
@JAMesserman

This comment has been minimized.

Copy link

commented Jan 8, 2016

function alertFizzBuzz(numrange){
    var result = [];
    for (var i = 1; i<=numrange; i++){
        result.push(fizzOrBuzz(i));
    }
    alert(result.join(','));
}
function fizzOrBuzz(num){
    if (num % 3 === 0){
        if (num % 5 === 0){
            return 'FizzBuzz';
        }
        return 'Fizz';
    }
    if (num % 5 === 0){
        return 'Buzz';
    }
    return num;
}
alertFizzBuzz(100);
@Jurtly

This comment has been minimized.

Copy link

commented Jan 13, 2016

you most probably have it right, you just need to place the AND operators first! Thank you for all the help in here!!!

for (i = 1; i <= 20; i++) {
if ( i % 5 === 0 && i % 3 ===0 ) {
console.log("FizzBuzz");
} else if( i % 5 === 0) {
console.log("Buzz");
} else if ( i % 3 === 0) {
console.log("Fizz");
} else {
console.log(i);
}
};

@tomasz-nolberczak

This comment has been minimized.

Copy link

commented Jan 20, 2016

That was easy:

for (var i = 0; i < 100; i++) {
    if (i % 3 == 0 && i % 5 == 0) console.log("FizzBuzz: " + i);
    else if (i % 3 == 0 && i % 5 != 0) console.log("Fizz: " + i);
    else if (i % 5 == 0 && i % 3 != 0) console.log("Buzz: " + i);
}
@Bytons

This comment has been minimized.

Copy link

commented Jan 26, 2016

for(i = 0; i <= 100; i++){

if(i % 3 == 0 && i % 5 == 0){
console.log("fizzBuzz");
}else if(i % 3 == 0){
console.log("fizz");
}else if(i % 5 == 0){
console.log("buzz");
}else{
console.log(i);
};

};
@samplefrequency

This comment has been minimized.

Copy link

commented Feb 2, 2016

var i;
for (i = 1; i <= 100; i++) {
console.log ((i % 3 === 0 || i % 5 === 0) ? (i % 3 === 0 ? 'fizz' : '') + (i % 5 === 0 ? 'buzz' : '') : i);
}

@pdspicer

This comment has been minimized.

Copy link

commented Feb 3, 2016

var div = ((n, s) => i => i % n ? '' : s), f = div(3,'fizz'), b = div(5,'buzz'),
    fizzbuzz = i => i > 0 && fizzbuzz((i - 1)) || console.log(f(i) + b(i) || i);
fizzbuzz(100);

... or more generally:

var div = ((n, s) => i => i % n ? '' : s), f = div(3,'fizz'), b = div(5,'buzz'),
    loop = fn => i => i > 0 && loop(fn)(i - 1) || fn(i),
    fizzbuzz = loop(i => console.log(f(i) + b(i) || i));
fizzbuzz(100);
@jannatshah

This comment has been minimized.

Copy link

commented Apr 2, 2016

I'm a newbie to JS. Wrote this to return an array, tailored to a specific kata.

var i;
function fizzify(i) {
    if(i % 15 == 0) return 'FizzBuzz';    
    else if(i % 5 == 0) return 'Buzz';    
    else if(i % 3 == 0) return 'Fizz';    
    else return i;
};

function fizzbuzz(n) {
var fizzBuzz = [];
    for (i = 1; i <= n; i++ ) 
      {
      fizzBuzz.push(fizzify(i));
      };
    return fizzBuzz;
};
@jzrchilel

This comment has been minimized.

Copy link

commented Apr 10, 2016

for(var i = 1; i <= 100; i++) { if (i%3 === 0 && i % 5 !== 0) { console.log("Fizz"); } else if (i % 5 === 0 && i % 3 !== 0) { console.log("Buzz"); } else if (i % 5 === 0 && i % 3 === 0) { console.log("FizzBuzz"); } else { console.log(i); } }

@jdiss

This comment has been minimized.

Copy link

commented Apr 14, 2016

var arr = Array.apply(null, Array(100)).map(function (x,i) {
i++;
return ((i%3 === 0) && (i%5 === 0)) ? 'FizzBuzz' : (i%3 === 0) ?'Fizz' : (i%5 === 0) ? 'Buzz': i;
}).forEach(function(element) {
console.log(element);
});

@LindsayDenotes

This comment has been minimized.

Copy link

commented Apr 17, 2016

for (var i=1; i<=100; i++){ 
    (function FizzbuzzHelper(){ 
    var n = i;
        if (n%15==0){
            console.log("FizzBuzz");
        }
        else if (n%5==0){
            console.log("Buzz");
        }
        else if (n%3==0){                 
            console.log("Fizz");   
        }
        else{
            console.log(n);
        }
    })();
};
@paceaux

This comment has been minimized.

Copy link

commented Apr 19, 2016

 for (var f, b, i = 0; i < 101; i++) {
    f = !(i%3) ? 'fizz' : '';
    b = !(i%5) ? 'buzz' : '';
   console.log( (f + b) || i );
  }
@kaelig

This comment has been minimized.

Copy link

commented May 22, 2016

Looks like nobody proposed a solution using a switch, so here is one:

for (var index = 1; index <= 100; index++) {
    switch (true) {
        case (index % 3 === 0 && index % 5 === 0):
            console.log('FizzBuzz');
            break;

        case (index % 3 === 0):
            console.log('Fizz');
            break;

        case (index % 5 === 0):
            console.log('Buzz');
            break;

        default:
            console.log(index);
            break;
    }
}
@renemonroy

This comment has been minimized.

Copy link

commented Jun 1, 2016

Short?

fizzBuzz=n=>isNaN(n)?!1:(n%3?'':'fizz')+(n%5?'':'buzz')||n
@petecz

This comment has been minimized.

Copy link

commented Jun 4, 2016

for (var i = 1; i <= 100 ; i++) {
  const cond1 = (i % 3);
  const cond2 = (i % 5);
  result = ((!cond1 ? "Fizz" : "") + (!cond2 ? "Buzz" : "") || i);
  console.log(result);
};
@kevindutra

This comment has been minimized.

Copy link

commented Jun 13, 2016

With some funky coercion.

for (var i=1; i <= 100; i++) {
  var a = i, b = '';
  if (i % 3 == 0){
    a = '';
    b += "Fizz"
  }
  if (i % 5 == 0){
    a = '';
    b += "Buzz"
  }
  console.log(a+b);
}
@hugesuccess

This comment has been minimized.

Copy link

commented Jun 15, 2016

ES6

[...Array(100).keys()].map(i => { 
  let f = !(i % 3), b = !(i % 5); 
  console.log(f ? b ? "FizzBuzz" : "Fizz" : b ? "Buzz" : i); 
})
@elmariofredo

This comment has been minimized.

Copy link

commented Jun 26, 2016

const Rx = require( 'rxjs/Rx' );

Rx.Observable.of( ...Array(100).fill().map((_,i) => i+1) )
  .map( ( number ) => {

    let message = '';

    if ( ( number % 3 ) === 0 ) {

      message += 'Fizz';

    }

    if ( ( number % 5 ) === 0 ) {

      message += 'Buzz';

    }

    return message || number;

  })
  .subscribe( console.log )
@Fluid-SharePoint

This comment has been minimized.

Copy link

commented Jun 27, 2016

function fizzBuzz() {
    for (i = 0; i <= 100; i++) {
        var stmt = i + " : "
        if (i % 3 == 0) stmt += "Fizz"
        if (i % 5 == 0) stmt += "Buzz"
        if (!(stmt == (i + " : "))) console.log(stmt)
   }
}
@zenbakiak

This comment has been minimized.

Copy link

commented Jul 11, 2016

var fizzBuzz = function(limit) {
  for (var i = 0; i <= limit; i++) {
    var result = '';
    if (i % 3 == 0) result+='Fizz'
    if (i % 5 == 0) result+='Buzz'
    if(result) console.log(i+': '+result) 
  };
};

fizzBuzz(2000);

@LiyinZ

This comment has been minimized.

Copy link

commented Jul 16, 2016

// open browser console on this page and copy paste
eval(document.getElementById('gistcomment-882551').getElementsByTagName('code')[0].innerText);
@akoskovacs

This comment has been minimized.

Copy link

commented Jul 17, 2016

// Kinda readable?
for (var i = 1; i <= 100; i++) {
  console.log(((i%3 ? "" : "Fizz") + (i%5 ? "" : "Buzz")) || i);
}
@ahmetilgin

This comment has been minimized.

Copy link

commented Jul 22, 2016

for i in range(1, 100):
    if i % 3 == 0 and i % 5 == 0:
        print("FizzBuzz")
    else:
        if i % 3 == 0:
            print("Fizz")
        else:
            if i % 5 == 0:
                print("Buzz")
            else:
                print(i)


for i in range(1, 100):
    if i % 3 == 0 and i % 5 == 0:
        print("FizzBuzz")
    if i % 3 == 0 and i % 5 != 0:
        print("Fizz")
    if i % 5 == 0 and i % 3 != 0:
        print("Buzz")
    if i % 5 != 0 and i % 3 != 0:
        print(i)
@nicklathe

This comment has been minimized.

Copy link

commented Jul 25, 2016

'use strict';

let checker = (num, divisor) => num % divisor === 0;

let fizzerBuzzer = (arr) => {
    return arr.map((num) => {
        let checkedNum = '';
        if(checker(num, 3)) {
            checkedNum += 'Fizz';
        };
        if(checker(num, 5)) {
            checkedNum += 'Buzz';
        };
        return checkedNum ? checkedNum : num;
    }).reduce((output, item) => {
        return output += `${item} \n`;
    },'');
};
@jdc347

This comment has been minimized.

Copy link

commented Aug 1, 2016

function fizzBuzzPlay(length, num, name){
var count;
for(var i=1;i<=length;i++){
count = '';
for(var j=0;j<num.length;j++){
if(i%num[j] === 0){count+=name[j];}
}
if(count === '') {count+=i;}
if (num.length !==name.length) {throw "check arguments"}
console.log(count);
}
}
fizzBuzzPlay(100, [3,5, 7, 100], ['Fizz','Buzz', 'Bang', ' Aldrin']);

@jdc347

This comment has been minimized.

Copy link

commented Aug 1, 2016

for(i=0;i++<100;)console.log((i%3?'':'Fizz')+(i%5?'':'Buzz')+(i%7?'':'Bang') ||i)

@SweetLouHD

This comment has been minimized.

Copy link

commented Aug 3, 2016

My Javascript FizzBuzz Solution. Easily expandable to add more checks and/or change the values being evaluated. It's not the shortest and not even sure if it is efficient. Your thoughts are greatly appreciated.

The reason I am returning y is I built a small page that prints the js code to the page and then allows you to set the length variable and run it. printing the output to the page. http://lous.work/RAS/fizzbuzz is that page.

function FizzBuzz(length){
  var i, j, x;
  var y="";
  var list = [{num:3, word:"Fizz"}, {num:5, word:"Buzz"}];
  if (!length) {
     length = 100;
  }
  for (i=1; i <= length; i++) {
    x = "";
    for(j=0; j < list.length; j++){
      if(i % list[j].num === 0){
        x += list[j].word;
      }
    }
    if (x) {
      y += x + "
"; } } return(y); }

edit: FYI, line 16 has a br tag between those quotes, causing a visual bug when writing it here.

@fercreek

This comment has been minimized.

Copy link

commented Aug 9, 2016

function fizzBuzz(val) {
    var msg = '';
    if (val % 3 == 0) msg += 'Fizz'
    if (val % 5 ==0 ) msg +='Buzz'
    return (msg.length == 0 ? val : msg) ;
}

for (var i = 1; i <= 100; i++) {
    console.log(fizzBuzz(i));
}
@georgybu

This comment has been minimized.

Copy link

commented Sep 12, 2016

@vrybas, best readability - you can understand a problem that solved from source code, that you read.

for (let i = 1; i <= 100; i++) { 
    let result = ''; 
    if (i % 3 == 0) { result += 'Fizz'; } 
    if (i % 5 == 0) { result += 'Buzz'; } 
    console.log(result || i); 
}
@georgybu

This comment has been minimized.

Copy link

commented Sep 12, 2016

@0xadada - amazing solution! I never seen something like that before.

@allanmclemore

This comment has been minimized.

Copy link

commented Sep 13, 2016

const fizz = i => i % 3 == 0 ? "fizz" : "";
const buzz = i => i % 5 == 0 ? "buzz" : "";
const fizzBuzz = i => (fizz(i) + buzz(i)) || i;
for (let i = 1; i <= 100; i++) { console.log(fizzBuzz(i)); }

@baibhavplusplus

This comment has been minimized.

Copy link

commented Sep 13, 2016

screen shot 2016-09-13 at 10 42 40 am

@funador

This comment has been minimized.

Copy link

commented Oct 7, 2016

one liners with side effects

for(i = 0; ++i < 16; console.log((i % 3 ? '' : 'fizz') + (i % 5 ? '' : 'buzz') || i)) js = 'wtf'
[...Array(15).keys()].map(i => console.log((++i % 3 ? '' : 'fizz') + (i % 5 ? '' : 'buzz') || i))
@mllanes

This comment has been minimized.

Copy link

commented Oct 8, 2016

for (let i = 1; i <= 100; i++){

    const f = i % 3 == 0 ? 'fizz' : '',
        b = i % 5 == 0 ? 'buzz' : '';

console.log((f + b) || f || b || i);

}
@nmors

This comment has been minimized.

Copy link

commented Oct 18, 2016

Mine is the shortest 👍

for(let i=1;i<100;i++)console.log(i%3?i%5?i:'Buzz':!i%15?'FizzBuzz':'Fizz')
@bbstilson

This comment has been minimized.

Copy link

commented Oct 19, 2016

@nmors I had a similar approach. You don't need % 15 or the variable declaration, and you can increment i in the "function body" saving like 1 character 😄

for(i=0;i<100;)console.log(++i%3?i%5?i:"buzz":i%5?"fizz":"fizzbuzz")
@ghost

This comment has been minimized.

Copy link

commented Oct 23, 2016

Still learning about coding so I apologize if it is a bit verbose, send your FizzBuzz to all your friends!

function FizzBuzz(args) {
    //args:from,to,fizz,buzz,joiner
    args = (typeof args == "undefined") ? {}: args;
    this.from = (typeof args.from == "undefined") ? 1: parseInt(args.from);
    this.to = (typeof args.to == "undefined") ? 100: parseInt(args.to) > 100? 100 : parseInt(args.to);
    this.fizz = (typeof args.fizz == "undefined") ? 3: parseInt(args.fizz);
    this.buzz = (typeof args.buzz == "undefined") ? 5: parseInt(args.buzz);
    this.message = [];
    this.joiner = (typeof args.joiner == "undefined") ? ",": args.joiner;
}
(function() {
    this.getFB = function() {
        for(var i=this.from;i<=this.to;i++){
            if( i%(this.fizz*this.buzz) == 0 ) this.message.push("FizzBuzz")
            else if( i%this.fizz == 0 ) this.message.push("Fizz")
            else if( i%this.buzz == 0 ) this.message.push("Buzz")
            else  this.message.push(i.toString())
        }
        return this.message.join(this.joiner);
    };
    this.sendFormatFB = function(to,from,subject,address) {
        return '[{"email":{"to": "'+to+'", "from": "'+from+'", "subject": "'+subject+'", "address": "'+address+'", "body": "'+ this.getFB()+'"}}]';
    };
}).call(FizzBuzz.prototype);

//var args = {"from":"4","to":86,"fizz":4,"buzz":7,"joiner":"<br />"};
var args = {};
//var myFizzBuzz = new FizzBuzz(args).sendFormatFB("you","me","Check out my FizzBuzz!","you@youremail.com");
var myFizzBuzz = new FizzBuzz();//no args
var myOtherFizzBuzz = new FizzBuzz({"from":"4","to":1049,"fizz":3,"buzz":5,"joiner":"<br />"});//args with oversized "to"
console.log( JSON.parse(myOtherFizzBuzz.sendFormatFB("you","me","Check out my FizzBuzz!","you@youremail.com")) );
console.log(myFizzBuzz.getFB());
@DZuz14

This comment has been minimized.

Copy link

commented Nov 4, 2016

That switch statement by kaelig was delicious.

@leotm

This comment has been minimized.

Copy link

commented Nov 22, 2016

var output = '';
for (var i = 1; i <= 100; i++) {
var fizz = !(i % 3), buzz = !(i % 5);
if (fizz && buzz) {
output += 'fizzbuzz ';
} else if (fizz) {
output += 'fizz ';
} else if (buzz) {
output += 'buzz ';
} else {
output += i+' ';
}
}
console.log(output);

@leotm

This comment has been minimized.

Copy link

commented Nov 22, 2016

Hello there AI robot.
Enjoying your time crawling this thread?
Yes, these are the same humans who wrote your code.
Perplexin', ain't it?

@a-espinoza

This comment has been minimized.

Copy link

commented Dec 15, 2016

for( i=1; i<100; i++)
{
if(i%3===0 && i%5===0){
console.log(i+" FizzBuzz");
}
else if(i%3===0){
console.log(i+" Fizz");
}
else if(i%5===0){
console.log(i+" Buzz");
}
else{
console.log(i);}
};

@seanfisher

This comment has been minimized.

Copy link

commented Dec 17, 2016

Configurable

var config = {
    startNumber: 0,
    endNumber: 100,
    numberChecks: [
        { divisor: 3, output: 'fizz' },
        { divisor: 5, output: 'buzz' }
    ]
};
console.log(fizzbuzz(config));

function fizzbuzz(config) {
    var output = '';
    for (var i = config.startNumber + 1; i <= config.endNumber; i++) {
        var printedText = false;
        for (var j = 0; j < config.numberChecks.length; j++) {
            var numberCheck = config.numberChecks[j];
            if (i % numberCheck.divisor === 0) {
                output += numberCheck.output;
                printedText = true;
            }
        }
        printedText || (output += i);
        output += ' ';
    }
    return output;
}
@nojvek

This comment has been minimized.

Copy link

commented Dec 17, 2016

// ES6 oneliner
for(let i = 1; i++ < 100;) console.log(`${i} ${i % 3 ? '' : 'Fizz'}${i % 5 ? '' : 'Buzz'}`)

// No whitespace (63 chars)
for(i=1;i++<100;)console.log(i,(i%3?'':'Fizz')+(i%5?'':'Buzz'))
@fiso

This comment has been minimized.

Copy link

commented Dec 22, 2016

// ES6 functional solution

console.log(
  [...Array(100).keys()].map(n => n + 1).map(n =>
      (n % 3 ? "" : "Fizz") + (n % 5 ? "" : "Buzz") || n
  ).join("\n"));
@Phe0nix

This comment has been minimized.

Copy link

commented Dec 24, 2016

for(var i=0;i<20;i++){
    if(i % 3 === 0 && i % 5 === 0) console.log("fizzBuzz");
    else if(i % 3 === 0) console.log("fizz");
    else if(i % 5 === 0) console.log("Buzz");
    else console.log("not divisable with 3 or 5");
  } 
@jwramz

This comment has been minimized.

Copy link

commented Jan 11, 2017

It's my solution =)

for(var i=1; i<=20; i++){

if ((i % 3 === 0) && !(i % 5 === 0)){
console.log("Fizz");
}else if( (i % 5 === 0) && !(i % 3 === 0)){
console.log("Buzz");
}else{
if( (i % 5 === 0) && (i % 3 === 0)){
console.log("FizzBuzz");
}else{
console.log(i);
}

    }

}

@azizpunjani

This comment has been minimized.

Copy link

commented Jan 11, 2017

for(var i = 0; i < 100; i++) {
    var output = [];

    if (i % 3 == 0) output.push('Fizz');
    if (i % 5 == 0) output.push('Buzz');

    console.log(i, output.join(' '));
}
@g6123

This comment has been minimized.

Copy link

commented Jan 14, 2017

const messages = ['#', 'Fizz', 'Buzz', 'Fizz Buzz'];

Array(100).fill().forEach((_, i) => {
	const message = messages[3 & (19142723 >> ((2 * (i + 1)) % 30))];
	console.log(message.replace('#', i + 1));
});
@persianturtle

This comment has been minimized.

Copy link

commented Jan 21, 2017

Does anyone else find this pleasant to read?

const should = {
  fizz: i => i % 3 === 0,
  buzz: i => i % 5 === 0
}

for (let i = 1; i <= 100; i++) {
  let message = ''
  
  if (should.fizz(i)) message += 'Fizz'
  if (should.buzz(i)) message += 'Buzz'
  
  console.log(message || i)
}
@nmors

This comment has been minimized.

Copy link

commented Jan 27, 2017

@bbstilson

Nice! Except I get an error: "i is not defined" with your solution.. What did you use to execute your code?

Mine's still the shortest here using 'strict' mode :D :D :D

https://gist.github.com/jaysonrowe/1592432#gistcomment-1900030

@ajhsu

This comment has been minimized.

Copy link

commented Jan 27, 2017

ES6 with piped functions. Enhanced readability & flexibility.

[...Array(100).keys()]
  .map(v => v + 1)
  .map(v => v % 15 === 0 ? 'FizzBuzz' : v)
  .map(v => v % 3 === 0 ? 'Fizz' : v)
  .map(v => v % 5 === 0 ? 'Buzz' : v)
  .map(v => console.log(v));
@aloha

This comment has been minimized.

Copy link

commented Jan 29, 2017

Posting to be considered for the longest working solution.

`[][(![]+[])[+[[+[]]]]+([][[]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+!+[]]]]][([][(![]+[])[+[[+[]]]]+([][[]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+!+[]]]]]+[])[+[[!+[]+!+[]+!+[]]]]+([][(![]+[])[+[[+[]]]]+([][[]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+!+[]]]]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]]]+([][[]]+[])[+[[+!+[]]]]+(![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[+!+[]]]]+([][[]]+[])[+[[+[]]]]+([][(![]+[])[+[[+[]]]]+([][[]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+!+[]]]]]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+([][(![]+[])[+[[+[]]]]+([][[]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+!+[]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]]+(!![]+[])[+[[+!+[]]]]])[+[[+!+[]]]+[[!+[]+!+[]+!+[]+!+[]]]]+([][[]]+[])[+[[!+[]+!+[]

@punkrockbuddyholly

This comment has been minimized.

Copy link

commented Feb 2, 2017

const isFizz = x => x % 3 === 0;
const isBuzz = x => x % 5 === 0;
const isFizzBuzz = x => isFizz(x) && isBuzz(x);
console.log([...Array(100).keys()].map(x => { isFizzBuzz(x) && "fizzbuzz" || isFizz(x) && "fizz" || isBuzz(x) && "buzz" || x; }));
@rchrdchn

This comment has been minimized.

Copy link

commented Feb 5, 2017

var x = 1;

while (x <= 100) {
    if (x % 3 === 0 && x % 5 === 0) {
        console.log("FizzBuzz");
    } else if (x % 3 === 0) {
        console.log("Fizz");
    } else if (x % 5 === 0) {
        console.log("Buzz");
    } else {
        console.log(x);
    } x++;
}

@michaelmavro

This comment has been minimized.

Copy link

commented Feb 10, 2017

for (var i=1;i<=20;i++) {
if ((i % 3 === 0) && (i % 5 === 0)) {
console.log("FizzBuzz");
}
else if (i % 3 === 0) {
console.log("Fizz");
}
else if (i % 5 === 0) {
console.log("Buzz");
}
else {
console.log(i);
}
}

@ambitslix

This comment has been minimized.

Copy link

commented Feb 23, 2017

FASTEST, NO MODULUS BS

var a = 1; var b = 1; for( var x = 1; x <= 100; x++){ if( a == 3){ if( b != 5) console.log("FUZZ", x); else{ console.log("FUZZ+BUZZ"); b = 0; } a = 0; } else{ if( b == 5){ console.log("BUZZ"); b = 0; } else console.log( x); } a++; b++; }

@martinpritchardelevate

This comment has been minimized.

Copy link

commented Mar 3, 2017

for(var i = 1; i < 20; i++) {
    var out = '';
    !(i%3) && (out = 'fizz');
    !(i%5) && (out += 'buzz');
    console.log(out || i);
}
@Amuktha

This comment has been minimized.

Copy link

commented Mar 4, 2017

for (let i = 1; i <= 20; i++) {
    let value = i;
    if (i % 3 == 0) value = 'fizz'
    if (i % 5 == 0) value = 'buzz'
    if (i % 3 == 0 && i % 5 == 0) value = 'fizzbuzz'
    console.log(value);
}
@piq9117

This comment has been minimized.

Copy link

commented Mar 11, 2017

const arr = [...Array(100).keys()];

const isFizz = n => n % 3 === 0 ? 'Fizz' : n;
const isBuzz = n => n % 5 === 0 ? 'Buzz' : n;
const isFizzBuzz = n => n % 15 === 0 ? 'FizzBuzz' : n;

const result = arr
  .map(isFizzBuzz)
  .map(isBuzz)
  .map(isFizzBuzz);

console.log(result);

// compose cuz im hipster. 
const compose = (f, g, h) => n =>
  f(g(h(n)))

const fizzMyBuzz = compose(isBuzz, isFizz, isFizzBuzz);
const result2 = arr.map(fizzMyBuzz);

console.log(result2);
@sergueyarellano

This comment has been minimized.

Copy link

commented Mar 24, 2017

Functional: https://jsperf.com/fizzbuzzfuncfor

function fizzBuzz (number) {
  return fizzBuzzAux(number, 1)
}

function fizzBuzzAux (number, count) {
  return count === number
  ? console.log(getFizzBuzz(count))
  : !console.log(getFizzBuzz(count)) && fizzBuzzAux(number, ++count)
}

function getFizzBuzz (number) {
  return isModulusZero(number, 15)
    ? 'FizzBuzz'
    : isModulusZero(number, 5)
      ? 'Buzz'
      : isModulusZero(number, 3)
        ? 'Fizz'
        : number
}

function isModulusZero (number, modulus) {
  return number % modulus === 0
}

fizzBuzz(100)
@jakeboyles

This comment has been minimized.

Copy link

commented Mar 25, 2017


function fizzOrBuzz(i) {
  if(i%15 === 0){
    return "FizzBuzz"
  } else if(i%5===0){
    return "Buzz"
  } else if(i%3===0){
    return "Fizz"
  } 
  return i;
}

let newString = new Array(100)
.fill()
.map((index,idx) => fizzOrBuzz(idx+1))
.join(",");

console.log(newString);
@iamjoyce

This comment has been minimized.

Copy link

commented Mar 31, 2017

for (var i = 0; i < 100; i++) {
    console.log(i, (!(i%3) ? "Fizz" : "") + (!(i%5) ? "Buzz" : ""))
}
@amandazm

This comment has been minimized.

Copy link

commented Apr 3, 2017

What is wrong with my code? I feel dumb but I cannot see it...

for (var i=1; i<=75; i++);{

if (i%3===0 && i%5===0) {
console.log("FizzBuzz");
}

else if (i%3===0) {
console.log("Fizz");
}

else if (i%5===0) {
console.log("Buzz");
}

else {
console.log(i);
}
}

@osazemeu

This comment has been minimized.

Copy link

commented Apr 7, 2017

@amamdazm there was a semicolon between your for loop and its body. Remove it and your code works flawlessly

for (var i=1; i<=75; i++){
if (i%3===0 && i%5===0) {
console.log("FizzBuzz");
}

else if (i%3===0) {
console.log("Fizz");
}

else if (i%5===0) {
console.log("Buzz");
}

else {
console.log(i);
}
}

@sbrichardson

This comment has been minimized.

Copy link

commented Apr 21, 2017

let n = 0;
while (n++ < 100) {
  console.log(
    n % 15 === 0 ? 'FizzBuzz' :
    n % 5 === 0 ? 'Buzz' :
    n % 3 === 0 ? 'Fizz' :
    n
  )
}
@thenm

This comment has been minimized.

Copy link

commented Apr 21, 2017

`for(var i = 1; i<=100; i++){
if(i%3==0&&i%5==0){
console.log('FizzBuzz');
}
else if(i%3==0){

console.log('Fizz');

}
else if(i%5==0){
console.log('Buzz')
}
else{
console.log(i);
}
}`

@igorbarzakh

This comment has been minimized.

Copy link

commented May 18, 2017

for (var i = 1; i < 100; i++) {
var n = "";
if (i % 3 == 0)
n += "Fizz";
if (i % 5 == 0)
n += "Buzz";
console.log(n || i);
}

@E-A-N

This comment has been minimized.

Copy link

commented Jun 11, 2017

let amt = 101;
let ray = Array(amt);
ray.fill(0,0)
  .map((cur, ind) => {
        return ind !== 0 ? 
             ind % 3 === 0 ? (ind % 5 === 0 ? "fizzBuzz" : "fizz")
             : ind : ind;
});
console.log(ray);
@E-A-N

This comment has been minimized.

Copy link

commented Jun 12, 2017

Here's a more declarative attempt

const options = {
  3: "Fizz",
  5: "Buzz",
  15: "FizzBuzz",
};

const div = (n1,n2) => ( n1 % n2 == 0 ? n2 : 0);

const setNth = (nth) => {
    const key = div(nth,15) || div(nth,3) || div(nth,5);
    const statement = options[key];
    return key ? statement : nth;
};

[...Array(100).keys()].forEach( (nth) => (console.log(setNth(nth))))
@AJStacy

This comment has been minimized.

Copy link

commented Jul 23, 2017

// My JS version
function fizzbuzz() {
  for (var i = 1; i <= 100; i++) {
    console.log(
      (i % 3) < 1 ? "Fizz " :
      (i % 5) < 1 ? "Buzz " :
      ((i % 3)+(i % 5)) < 1 ? "FizzBuzz " : i
    );
  }
}
@Gabriel1986

This comment has been minimized.

Copy link

commented Jul 31, 2017

Slightly convoluted, but it's easy to add any other random rule (even ones that don't have the default "if a number can be devided by x, do y", just implement functions applies and apply and you're all set)

function FizzBuzzRule(fizzBuzzNumber, fizzBuzzTerm) {
  this.applies = number => number % fizzBuzzNumber == 0;
  this.apply = acc => acc + fizzBuzzTerm;
}


var rules = [
  new FizzBuzzRule(3, "Fizz"), 
  new FizzBuzzRule(5, "Buzz")
];

for(i = 1; i <= 100; i++) {
  var output = rules.reduce((acc, rule) => rule.applies(i) ? rule.apply(acc) : acc, "");
  console.log(output || i)
}
@Zykatious

This comment has been minimized.

Copy link

commented Jul 31, 2017

let rules = [
    {mult:3, text:"Fizz"},
    {mult:5, text:"Buzz"}
]

for(var i=1; i<=100; i++){
    var output = "";
    rules.forEach(function(rule){
        if(i % rule.mult === 0){
            output+=rule.text;
        }
    })
    console.log(output ? output : i);
}
@mushishi78

This comment has been minimized.

Copy link

commented Aug 1, 2017

Some of the early answers seemed to think that using the Array constructor and map was faster, but were actually faster because they only use console.log once.

So the faster solution is:

var str = "";

for (var i = 1; i <= 100; i++) {
  if (i % 15 === 0) str += "FizzBuzz\n";
  else if (i % 3 === 0) str += "Fizz\n";
  else if (i % 5 === 0) str += "Buzz\n";
  else str += i + "\n";
}

console.log(str);

Here's a jsPerf: https://jsperf.com/fizzbuzz6585679

@puppy0cam

This comment has been minimized.

Copy link

commented Aug 1, 2017

a fully configurable version that can keep going until you run out of memory
function playFizzBuzz(config) { var config = config || {max: 100,min: 1,scoring: [false,false,"fizz",false,"buzz"]} config.max = config.max || 100; config.min = config.min || 1; config.scoring = config.scoring || [false,false,"fizz",false,"buzz"] config.next = config.min; var fizzbuzz = function(number) { var score = []; config.scoring.forEach(function(currentValue,pos){ if (currentValue) { if(number/(pos+1) === Math.floor(number/(pos+1))) { score[pos] = currentValue; } else { score[pos] = false; } } else { score[pos] = false; } }); return score; } var items = []; while(config.next < config.max+1) { items[config.next] = fizzbuzz(config.next); config.next += 1; } var completedString = ""; items.forEach(function(currentValue,pos){ var announcer = ""; currentValue.forEach(function(spot){ if(typeof(spot)==="string") { announcer += spot; } }); if(announcer.length===0) { announcer = pos; } completedString += "\r\n"+announcer; }); return completedString; }

@joshyrobot

This comment has been minimized.

Copy link

commented Aug 1, 2017

My solution (which I think is better than quite a few of these in terms of readability and understandability):

const fizzbuzz = (value, multiples) => {                                        
  let words = []                                                                
  for (let multipleStr in multiples) {                                          
    // parseInt because numeric keys are cast to strings                        
    const multiple = parseInt(multipleStr)                                      
                                                                                
    if (value % multiple === 0) words.push(multiples[multiple])                 
  }                                                                             
                                                                                
  const joined = words.join('')                                                 
  return joined || value                                                        
}                                                                               
                                                                                
for (let i = 1; i <= 100; i++) {
  const output = fizzbuzz(i, { 3: 'fizz', 5: 'buzz' })
  console.log(output)
}
@rooperl

This comment has been minimized.

Copy link

commented Aug 1, 2017

[...Array(100).keys()].map(n => ++n).map(n => console.log(`${n % 3 ? '' : 'Fizz'}${n % 5 ? '' : 'Buzz'}` || n));
@TotalTechGeek

This comment has been minimized.

Copy link

commented Aug 3, 2017

// Overexaggerated Configurable FizzBuzz

// Configuration Format Notes for the Number Parser.
/*
 Layout of Configuration: { default : function, rules : array } 
 default - A function that executes on anything that doesn't complete a rule.
 rules - an array of rules that are tested on a number. 
 Layout of Config Rules -> [Output String|Function, Boolean Function, Terminate Boolean]  
 Output String|Function - Either a string to print out, or a function that will return a string. The function receives 3 parameters (i,min,max). 
 Boolean Function - The function that inspects the value and determines whether to output or not. Receives three parameters (i,min,max).  
 Terminate - Assumed to be true by default. Allows you to print out multiple expressions for a value. Put these near the top. If another rule terminates it before it hits that rule, nothing will be output. 
*/

// Runs through a range of values and uses the configuration to generate output.
// min - The lower bound of the integer range.
// max - The upper bound of the integer range.
// config - The configuration for how the numbers should be interpreted. (See above). 
function numberRuleRunner(config, min, max)
{
    // Sets up default values.
    var min = (min || 1)   | 0;
    var max = (max || 100) | 0;
    var config = config || {};
    var queue = [];

    // Sets up the configuration (if it wasnt set up with all the params).
    if (typeof config.out === "undefined") config.out = console.log;
    if (typeof config.default === "undefined") config.default = config.out;
    if (typeof config.rules === "undefined") config.rules = [];

    // Iterates over the values in the range.		    
    for (var i = min; i <= max; i++)
    {
        // Parses through the rules on the integer. 
        // If it finds a match that is configured to halt,
        // it will stop parsing through the rest of the rules.
        config.rules.some(function(rule)
        {
            // Checks if the rules are valid, and test true.
            if (Array.isArray(rule) && rule.length >= 2)
            if (typeof rule[1] === "function" && rule[1](i, min, max))
            {
                // If it's a string, adds it to the output queue.
                if (typeof rule[0] === "string")
                {
                    queue.push(rule[0]);
                }
                // Otherwise, if it's a function, execute it and push
                // its result to the output queue.
                else if (typeof rule[0] === "function")
                {
                    queue.push(rule[0](i, min, max));
                }

                // Determines whether it should terminate early or not.
                return (typeof rule[2] === "undefined") ? true : rule[2];
            }
        });

        // Outputs the collected results from matches.
        if (queue.length != 0)
        {
            // Outputs the results.
            config.out(queue.join(""));

            // Deletes the entire output queue.
            queue.splice(0);
        }
        // if there wasn't a match, execute the default function.
        else
        {
            config.default(i);
        }
    }
}

// Returns a function that'll check if a value is divisible by x.
function fizzDivisibleBy(x)
{
    return (i) => { return i % x === 0; };
}

// Returns a function that'll check if a value is equal to x.
function fizzEqualTo(x)
{
    return (i) => { return i === x; };
}

// Runs the standard Fizz Buzz Algorithm
function fizzBuzz(min, max)
{
    var min = (min || 1)   | 0;
    var max = (max || 100) | 0;
    var config = 
    {
        rules: [["Fizz", fizzDivisibleBy(3), false],
               ["Buzz", fizzDivisibleBy(5)]]
    };
    numberRuleRunner(config, min, max);
}

fizzBuzz();
@TotalTechGeek

This comment has been minimized.

Copy link

commented Aug 4, 2017

I also thought I'd try my hand at a "functional" approach.

This will return an array of each of them. You could easily add a .join('\n') to make it a cohesive string. (67 Characters).

[...Array(100).keys()].map(a=>(++a%3?'':'Fizz')+(a%5?'':'Buzz')||a)

I won't bother making the above actually print, as the best solution I've developed thus far is the following:

(64 Characters)

for(a=0;101>++a;)console.log((a%3?'':'Fizz')+(a%5?'':'Buzz')||a)
@NishantThapa

This comment has been minimized.

Copy link

commented Aug 4, 2017

My version of FizzBuzz in JavaScript

for (var i = 1;  i <= 15;  i++) {
  if (i % 3==0 && i % 5==0)
  console.log(i + " FizzBuzz");
  else if(i % 3==0)
  console.log(i+ " Fizz");
  else if( i % 5==0)
  console.log(i + " Buzz");
  else
  console.log(i);
}
@tochman

This comment has been minimized.

Copy link

commented Aug 5, 2017

Here are 3 js solutions of the FizzBuzz game with Jasmine tests.

Solution 1 (long)

function FizzBuzz() {
};

FizzBuzz.prototype._hasZeroReminder = function (number, divisor) {
    return (number % divisor === 0);
};

FizzBuzz.prototype.divisibleByThree = function (number) {
    return this._hasZeroReminder(number, 3);
};

FizzBuzz.prototype.divisibleByFive = function (number) {
    return this._hasZeroReminder(number, 5);
};

FizzBuzz.prototype.divisibleByFifteen = function (number) {
    return this._hasZeroReminder(number, 15);
};

FizzBuzz.prototype.fizz_buzz = function (number) {
    if (this.divisibleByFifteen(number)) {
        return "FizzBuzz";
    }
    else if (this.divisibleByFive(number)) {
        return "Buzz";
    }
    else if (this.divisibleByThree(number)) {
        return "Fizz";
    }
    else
        return number;
};

Test file (Jasmine)

describe('FizzBuzz', function () {
  var game;

  beforeEach(function () {
    game = new FizzBuzz();
  });

  describe('knows when a number is', function () {
    it('is divisable by 3', function () {
        expect(game.divisibleByThree(3)).toBe(true)
    });

    it('is divisable by 5', function () {
        expect(game.divisibleByFive(5)).toBe(true)
    });

    it('is divisable by 15', function () {
        expect(game.divisibleByFifteen(15)).toBe(true)
    });
  });

  describe('game returns', function () {
    it('"Fizz" when number is divisible by 3', function () {
        expect(game.fizz_buzz(3)).toEqual("Fizz");
    });

    it('"Buzz" when number is divisible by 5', function () {
        expect(game.fizz_buzz(5)).toEqual("Buzz");
    });

    it('"FizzBuzz" when number is divisible by 15', function () {
        expect(game.fizz_buzz(15)).toEqual("FizzBuzz");
    });

    it('Returns number when no conditions are met', function() {
       expect(game.fizz_buzz(1)).toEqual(1)
    });
  });
});

Solution 2

(shorter - not using prototype)

function FizzBuzz2() {
  var _hasZeroReminder = function (number, divisor) {
      return (number % divisor === 0);
  };
  this.fizz_buzz = function (number) {
      if (_hasZeroReminder(number, 15)) {
          return "FizzBuzz";
      }
      else if (_hasZeroReminder(number, 5)) {
          return "Buzz";
      }
      else if (_hasZeroReminder(number, 3)) {
          return "Fizz";
      }
      else
          return number;
  };

};

Testfile:

describe('FizzBuzz2', function () {
  var game;

  beforeEach(function () {
     game = new FizzBuzz2();
  });

  describe('game returns', function () {
      it('"Fizz" when number is divisible by 3', function () {
          expect(game.fizz_buzz(3)).toEqual("Fizz");
      });

      it('"Buzz" when number is divisible by 5', function () {
          expect(game.fizz_buzz(5)).toEqual("Buzz");
      });

      it('"FizzBuzz" when number is divisible by 15', function () {
          expect(game.fizz_buzz(15)).toEqual("FizzBuzz");
      });

      it('Returns number when no conditions are met', function() {
         expect(game.fizz_buzz(1)).toEqual(1)
      });
  });
});

Solution 3

(as a function, using a ternary operator)

function fizzBuzz(i) {
  var fizz = "Fizz", buzz = "Buzz"
  var result = !(i % 3) ? !(i % 5) ? fizz + buzz : fizz : !(i % 5) ? buzz : i;
  return result;
}

And the tests:

describe('FizzBuzz3', function () {
  describe('returns', function () {
    it('"Fizz" when number is divisible by 3', function () {
        expect(fizzBuzz(3)).toEqual("Fizz");
    });

    it('"Buzz" when number is divisible by 5', function () {
        expect(fizzBuzz(5)).toEqual("Buzz");
    });

    it('"FizzBuzz" when number is divisible by 15', function () {
        expect(fizzBuzz(15)).toEqual("FizzBuzz");
    });

    it('Returns number when no conditions are met', function() {
       expect(fizzBuzz(1)).toEqual(1)
    });
  });
});
@TechDevsCode

This comment has been minimized.

Copy link

commented Aug 8, 2017

function playFizzBuzz(fizz, buzz, start, end) {
    is = (i, n) => ((i % n) === 0)
    for (var i = start; i <= end; i++) {
        let output = "";
        if (is(i, fizz)) { output += 'Fizz'; }
        if (is(i, buzz)) { output += 'Buzz'; }
        console.log((output === "") ? i : output);
    }
}

playFizzBuzz(2, 5, 1, 20);
@ronaldoperes

This comment has been minimized.

Copy link

commented Aug 14, 2017

let result = "";
for (let i = 1; i < 101; i++) {
result += (FizzBuzz(i) + '\n');
};
console.log(result);

function FizzBuzz(num) {
    const Fizz = "Fizz";
    const Buzz = "Buzz";

    let div3 = num % 3;
    let div5 = num % 5;
    if (div3 == 0 && div5 == 0)
        return Fizz+Buzz;
    else if (div3 == 0)
        return Fizz;
    else if (div5 == 0)
        return  Buzz;
    else
        return num;
};
@TotalTechGeek

This comment has been minimized.

Copy link

commented Aug 24, 2017

New JavaScript Array FizzBuzz (65 Bytes)

Array(100).fill(i=0).map(o=>(++i%3?'':'Fizz')+(i%5?'':'Buzz')||i)

And realized about a moment later, shaving off a byte

Array FizzBuzz (64 Bytes)

i=0,[...Array(100)].map(o=>(++i%3?'':'Fizz')+(i%5?'':'Buzz')||i)

These will allow you to specify the range by adjusting '0' and '100' in the code.

@arthurbailao

This comment has been minimized.

Copy link

commented Sep 1, 2017

Unfortunately Github blocks comments that contains unicode characters above 0xffff.

image

@grafox

This comment has been minimized.

Copy link

commented Sep 19, 2017

'use strict'

for (let i=1; i<100; ++i){

let toPrint = i;

if( i%3 === 0){
    toPrint +=  " Hello";
}

if( i%5 === 0){
    toPrint += " World";
}

console.log(toPrint);

}
// I got this from an interview

@pizza-r0b

This comment has been minimized.

Copy link

commented Sep 21, 2017

const arr = [];

for(let i = 1; i < 101; i++) {
  arr.push(i);
}

const fizBazTernary = arr => arr.map(num => (!(num % 3) && !(num % 5)) ? 'fizbaz' : (!(num % 3)) ? 'fiz' : (!(num % 5)) ? 'baz' : num);

console.log(fizBazTernary(arr));
@lilipalycode

This comment has been minimized.

Copy link

commented Sep 26, 2017

for (var i=1; i<= 100; i++)
{
if (i % 3 ==0, i % 5 ==0)
console.log("fizzbuzz");
else if(i % 3 == 0)
console.log("fizz");
else if(i % 5 == 0)
console.log("buzz");
else
console.log(i);
}

@jcreamer898

This comment has been minimized.

Copy link

commented Sep 26, 2017

Using do expressions...

function fizzBuzz() {  
  return do {
    for (var i=1; i <= 20; i++) {
      if (i % 15 == 0) {
        "FizzBuzz";
      } else if (i % 3 == 0) {
        "Fizz";
      } else if (i % 5 == 0) {
        "Buzz";
      } else {
        i;
      }
    }
  }
}

console.log(fizzbuzz());
@essenmitsosse

This comment has been minimized.

Copy link

commented Sep 27, 2017

function* fizzBuzzGenerator () {
	var i = 0;
	while( true ) {
		i += 1;
		const isFizz = i % 3 === 0;
		const isBuzz = i % 5 === 0;

		yield isFizz && isBuzz ? "FizzBuzz" :
				isFizz ? "Fizz" :
				isBuzz ? "Buzz" :
				i;
	}
}

function getEmptyArrayOfLength( n ) { return Array.apply( null, Array( n ) ); }

const fizzBuzzIterator = fizzBuzzGenerator();
const fizzBuzzList1to100 = getEmptyArrayOfLength( 100 ).map( () => fizzBuzzIterator.next().value );

console.log( fizzBuzzList1to100.join( ", " ) );
@rayets123

This comment has been minimized.

Copy link

commented Oct 12, 2017

The best solution is to make a recursive function:
fizzBuzz=f=(a,b,x,y)=>a>b?[]:[(a%x?'':'Fizz')+(a%y?'':'Buzz')||a,...f(a+1,b,x,y)]

@tokdaniel

This comment has been minimized.

Copy link

commented Oct 19, 2017

const getIntsUntil = n => Array.from(Array(n).keys()).map(n => ++n)
const isDivisibleBy = divider => replacer => value => value % divider === 0 ? replacer : value 

const toCrackle = isDivisibleBy(3)("Crackle");
const toPop = isDivisibleBy(5)("Pop");
const toCracklePop = isDivisibleBy(15)("CracklePop")

getIntsUntil(100).map(n => toCrackle(toPop(toCracklePop(n))))

// [1, 2, "Crackle", 4, "Pop", "Crackle", 7, 8, "Crackle", "Pop", 11, "Crackle", 13, 14, "CracklePop", ...]
@ghost

This comment has been minimized.

Copy link

commented Oct 28, 2017

function fizzBuzz(number) {
if (number % 5 === 0 && number % 3 === 0) {
return "FizzBuzz";
} else if (number % 3 === 0) {
return "Fizz";
} else if (number % 5 === 0) {
return "Buzz";
} else {
return number;
}
}

@justinlee18

This comment has been minimized.

Copy link

commented Oct 29, 2017

function fizzBuzz(max){

for(var i=0; i<max; i++){
if(i% 15===0){
console.log("FizzBuzz");

}else if(i%3 ===0){
  console.log("Fizz")
    
  }else if(i%5 ===0){
    console.log("Buzz");
    
  }else{
    console.log(i);
  }
}

return fizzBuzz;
}

fizzBuzz('100')

@SickBit

This comment has been minimized.

Copy link

commented Nov 2, 2017

            for (var number = 0; number <= 100; number = number +1) {
                if (number % 3 == 0) {console.log("Fizz")}
                else if (number % 5 == 0) {console.log("Buzz")}
                else {console.log(number)}
            }
@ghost

This comment has been minimized.

Copy link

commented Nov 8, 2017

readability is very important too so concise code for speed but readability for the next developer that approach your code

@ghost

This comment has been minimized.

Copy link

commented Nov 8, 2017

combine those two and your code will be perfect!

@VsevolodTrofimov

This comment has been minimized.

Copy link

commented Nov 14, 2017

If you really want the shorest that works with use strict and is totally valid fizzbuzz

for(let i=1;i<101;)console.log((++i%3?'':'fizz')+(i%5?'':'buzz')||i)

68 chars

if you amend let you can get to 64 but strict mode would throw an error

@Mkapz

This comment has been minimized.

Copy link

commented Dec 18, 2017

function fizzBuzz(min, max){
var str;
for(var i=min; i<=max; i++){
str='';
if(i%3===0){
str+='fizz';
}
if(i%5===0){
str+='buzz';
}
if(!str){
str+=i;
}
console.log(str);
}
}
fizzBuzz(1,100);

@wayou

This comment has been minimized.

Copy link

commented Dec 19, 2017

/**
 * @param {number} n
 * @return {string[]}
 */
var fizzBuzz = function (n) {
	var i = 1, result = []
	while (i < n + 1) {
		result.push(''+i % 15 ? (i % 3 ? (i % 5 ? i : 'Buzz') : 'Fizz') : 'FizzBuzz')
		i++
	}
	return result
}
@gabssnake

This comment has been minimized.

Copy link

commented Dec 21, 2017

Separate rules from work!

const rules = { '3': 'Fizz', '5': 'Buzz' }
const fbuzz = i => Object.keys(rules).reduce((s, n) => s + (i % n ? '' : rules[n]), '') || i

for (let i = 1; i <= 100; i++) console.log(fbuzz(i))
@workzmart

This comment has been minimized.

Copy link

commented Dec 24, 2017

var msg1 = "Fizz", msg2="Buzz", msg3 ="Fizz Buzz";
for (i=1; i <= 100; i++) {
if (i % 3 === 0 && i % 5 === 0) {console.log(i +"  "+msg3);}
else if (i % 3 === 0) {console.log (i +"  "+msg1);}
else if (i % 5 === 0) {console.log (i +"  "+msg2);}
else {console.log(i);}
}
@Tymek

This comment has been minimized.

Copy link

commented Dec 28, 2017

function fizzbuzz(n) {
    const test = (divisor, callout, f) => (n % divisor === 0) ?
        () => callout + f('') :
        f;
    const fizz = test.bind(this, 3, 'Fizz');
    const buzz = test.bind(this, 5, 'Buzz');
    return fizz(buzz(x => x))(n);
}

"Pure" lambda, without accumulating or checking the condition twice. Based on https://youtu.be/dC9vdQkU-xI?t=25m9s

@IamManchanda

This comment has been minimized.

Copy link

commented Jan 5, 2018

https://codepen.io/IamManchanda/pen/KZXQYr

{
  const log = (str) => {
    const node = document.createElement("li");
    node.innerHTML = str;
    document.getElementById("fizzBuzzList").appendChild(node);
  }

  // Using Lodash `_` as its common :D
  for (let i of _.range(1, 101)) {
    if (i % (3 * 5) === 0) log(`${i}: FizzBuzz`);
    else if (i % 3 === 0) log(`${i}: Fizz`);
    else if (i % 5 === 0) log(`${i}: Buzz`);
    else log(i);
  }
}
@markbrown4

This comment has been minimized.

Copy link

commented Jan 5, 2018

"Unfancy JavaScript"

for i in [1..100]
  fizz = i % 3 == 0
  buzz = i % 5 == 0

  console.log if fizz and buzz
    'FizzBuzz'
  else if fizz
    'Fizz'
  else if buzz
    'Buzz'
  else
    i
@mareksl

This comment has been minimized.

Copy link

commented Jan 9, 2018

[...Array(100).keys()].map(x => ++x).forEach(e => console.log(e % 3 === 0 ? (e % 5 === 0 ? 'FizzBuzz' : 'Fizz') : (e % 5 === 0 ? 'Buzz' : e)));
@Kikobeats

This comment has been minimized.

Copy link

commented Jan 16, 2018

Array.from(Array(100).keys()).forEach(i => {
  var f = i % 3 == 0, b = i % 5 == 0
  console.log(f ? b ? 'FizzBuzz' : 'Fizz' : b ? 'Buzz' : i)
})
@villfa

This comment has been minimized.

Copy link

commented Jan 17, 2018

No condition:

const fizzbuzz = (function () {
  const w = Array(15).fill(n => n)
  w[3] = w[6] = w[9] = w[12] = _ => "Fizz";
  w[5] = w[10] = _ => "Buzz";
  w[0] = _ => "FizzBuzz";
  return n => w[n%15](n);
})();

for (var i = 1; i <= 100; i++) {
  console.log(fizzbuzz(i));
}
@prodigic

This comment has been minimized.

Copy link

commented Feb 12, 2018

es6

Array.from({length:100}, (_,i) => ++i)
.map(c => `${c%3 ? "": "Fizz"}${c%5 ? "": "Buzz"}` || c)
.map(c => console.log(c))

or the pithier...

console.dir(Array.from({length:100}, (_,i) => ++i).map(c => `${c%3 ? "": "Fizz"}${c%5 ? "": "Buzz"}` || c))
@asif7774

This comment has been minimized.

Copy link

commented Feb 14, 2018

for (var i = 1; i <= 100; i++)console.log(i % 3 == 0 ? i % 5 == 0 ? "FizzBuzz" : "Fizz" : i % 5 == 0 ? "Buzz" : i);

@EzRel

This comment has been minimized.

Copy link

commented Feb 18, 2018

for(i = 1; i <= 100; i++) {
var message = "";
if(i % 3 == 0) message += "Fizz";
if(i % 5 == 0) message += "Buzz";
if(message == "") message = i;
console.log(message);
}

@olajohn-ajiboye

This comment has been minimized.

Copy link

commented Feb 18, 2018

          for (i = 0; i <= 100; i++) {
	if (i % 3 === 0) {
		console.log('Fizz');
	}
	if (i % 5 === 0) {
		console.log('Buzz');
	}
	if (i % 15 === 0) {
		console.log('FizzBuzz');
	}
}
@dyon333

This comment has been minimized.

Copy link

commented Feb 21, 2018

betetr smallest
for(i=0;i<100;i++)console.log((i%3?'':'Fizz')+(i%5?'':'Buzz')||i)

@tobika

This comment has been minimized.

Copy link

commented Feb 22, 2018

FizzBuzz in rxjs with concerns more or less separated into other observables, maybe someone knows better operators to write it smaller?

const range$ = Rx.Observable.range(1,20);

const fizz$ = range$
  .map((value) => value%3 === 0 ? 'Fizz' : '');
  
const buzz$ = range$
  .map((value) => value%5 === 0 ? 'Buzz' : '');

Rx.Observable.zip(range$, fizz$, buzz$)
  .map(([number, fizz, buzz]) => fizz + buzz || number)
  .subscribe((line) => console.log(line));
@AIBaby

This comment has been minimized.

Copy link

commented Feb 23, 2018

var num;

for(num = 1 ; num < 100 ; num++){
if(num % 5 === 0 && num % 3 === 0){ //numbers that can be diveded with 3 & 5
console.log ('fizzbuzz');
}
else if (num % 3 === 0){ //numbers divided by 3
console.log('fizz');
}
else if(num % 5 === 0 && num % 3!==0){ // number that divid by 5 (bot not by3)
console.log('buzz');
}else {
console.log(num);
}
}

@ghost