Last active
February 16, 2021 21:10
-
-
Save ifvictr/e4991151b7838a4a1c63b1b2b59acf23 to your computer and use it in GitHub Desktop.
FizzBuzz in JavaScript without any conditional statements. 174 bytes when minified.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
p = ['Fizz', 'Buzz', '', 1] | |
c = Math.ceil | |
f = n => | |
[ | |
() => {}, | |
() => { | |
a = n / 3 | |
b = n / 5 | |
console.log( | |
p[2 * (c(a) - ~~a)] + | |
p[1 + c(b) - ~~b] + | |
p[2 + (c(a) - ~~a) * (c(b) - ~~b)] | |
) | |
f(++p[3]) | |
} | |
][c((x = n / 101)) - ~~x]() | |
_ = f(1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
p=["Fizz","Buzz","",1],c=Math.ceil,f=(z=>[()=>{},()=>{a=z/3,b=z/5,console.log(p[2*(c(a)-~~a)]+p[1+c(b)-~~b]+p[2+(c(a)-~~a)*(c(b)-~~b)]),f(++p[3])}][c(x=z/101)-~~x]()),_=f(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment