Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

Commonmark migration
Source Link

#JavaScript, 65 bytes

JavaScript, 65 bytes

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

The shortest approach I've found yet. Perhaps there's a better one; suggestions are welcome. This was originally flagged ES6, but this works in ES5, and to my knowledge there's not a shorter way with ES6 features.

Here's another attempt, using .slice and some complicated maths for a total of 66 bytes:

for(i=0;i++<100;console.log('FizzBuzz'.slice(i%3&&4,i%5?4:8)||i));

(Thanks to Ben Fortune for a couple of handy tricks!)

#JavaScript, 65 bytes

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

The shortest approach I've found yet. Perhaps there's a better one; suggestions are welcome. This was originally flagged ES6, but this works in ES5, and to my knowledge there's not a shorter way with ES6 features.

Here's another attempt, using .slice and some complicated maths for a total of 66 bytes:

for(i=0;i++<100;console.log('FizzBuzz'.slice(i%3&&4,i%5?4:8)||i));

(Thanks to Ben Fortune for a couple of handy tricks!)

JavaScript, 65 bytes

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

The shortest approach I've found yet. Perhaps there's a better one; suggestions are welcome. This was originally flagged ES6, but this works in ES5, and to my knowledge there's not a shorter way with ES6 features.

Here's another attempt, using .slice and some complicated maths for a total of 66 bytes:

for(i=0;i++<100;console.log('FizzBuzz'.slice(i%3&&4,i%5?4:8)||i));

(Thanks to Ben Fortune for a couple of handy tricks!)

golfed alternate solution
Source Link
ETHproductions
  • 50.3k
  • 6
  • 96
  • 241

#JavaScript, 65 bytes

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

The shortest approach I've found yet. Perhaps there's a better one; suggestions are welcome. This was originally flagged ES6, but this works in ES5, and to my knowledge there's not a shorter way with ES6 features.

Here's another attempt, using .substringslice and some complicated maths for a total of 66 bytes:

for(i=0;i++<100;console.log('FizzBuzz'.substringslice(i%3?4:0i%3&&4,i%5?4:8)||i));

(Thanks to Ben Fortune for a couple of handy tricks!)

#JavaScript, 65 bytes

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

The shortest approach I've found yet. Perhaps there's a better one; suggestions are welcome. This was originally flagged ES6, but this works in ES5, and to my knowledge there's not a shorter way with ES6 features.

Here's another attempt, using .substring and some complicated maths:

for(i=0;i++<100;console.log('FizzBuzz'.substring(i%3?4:0,i%5?4:8)||i));

#JavaScript, 65 bytes

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

The shortest approach I've found yet. Perhaps there's a better one; suggestions are welcome. This was originally flagged ES6, but this works in ES5, and to my knowledge there's not a shorter way with ES6 features.

Here's another attempt, using .slice and some complicated maths for a total of 66 bytes:

for(i=0;i++<100;console.log('FizzBuzz'.slice(i%3&&4,i%5?4:8)||i));

(Thanks to Ben Fortune for a couple of handy tricks!)

added 153 characters in body
Source Link
ETHproductions
  • 50.3k
  • 6
  • 96
  • 241

#Javascript#JavaScript, 65 bytes

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

The shortest approach I've found yet. Perhaps there's a better one; suggestions are welcome. This was originally flagged ES6, but this works in ES5, and to my knowledge there's not a shorter way with ES6 features.

Here's another attempt, using .substring and some complicated maths:

for(i=0;i++<100;console.log('FizzBuzz'.substring(i%3?4:0,i%5?4:8)||i));

#Javascript, 65 bytes

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

The shortest approach I've found yet. Perhaps there's a better one; suggestions are welcome. This was originally flagged ES6, but this works in ES5, and to my knowledge there's not a shorter way with ES6 features.

#JavaScript, 65 bytes

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

The shortest approach I've found yet. Perhaps there's a better one; suggestions are welcome. This was originally flagged ES6, but this works in ES5, and to my knowledge there's not a shorter way with ES6 features.

Here's another attempt, using .substring and some complicated maths:

for(i=0;i++<100;console.log('FizzBuzz'.substring(i%3?4:0,i%5?4:8)||i));
added 127 characters in body
Source Link
ETHproductions
  • 50.3k
  • 6
  • 96
  • 241
Loading
Source Link
ETHproductions
  • 50.3k
  • 6
  • 96
  • 241
Loading

AltStyle によって変換されたページ (->オリジナル) /