Last active
August 29, 2015 14:14
-
-
Save ToJans/5e232437c4c64f8c5a25 to your computer and use it in GitHub Desktop.
99 bottles of beer as short as possible in ECMAScript 6 - currently 142 characters
This file contains 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
x="" | |
b=r=>`${c||"No more"} bottle${c-1?"s":""} of beer${r&&c--||" on the wall"} | |
` | |
for(c=99;c;)x+=b()+b(1)+`Take one down, pass it around | |
`+b() |
152:
b=r=>`${c||"No more"} bottle${c-1?"s":""} of beer${r?c--||"":" on the wall"}`,x=""
for(c=99;c;)x+=b()+`
${b(1)}
Take one down, pass it around
${b()}
`
x
150 (don't need the x at the end to print)
b=r=>`${c||"No more"} bottle${c-1?"s":""} of beer${r?c--||"":" on the wall"}`,x=""
for(c=99;c;)x+=b()+`
${b(1)}
Take one down, pass it around
${b()}
`
148 (forgot an easy one)
b=r=>`${c|"No more"} bottle${c-1?"s":""} of beer${r?c--|"":" on the wall"}`,x=""
for(c=99;c;)x+=b()+`
${b(1)}
Take one down, pass it around
${b()}
`
147 - almost tweetable!
x=""
for(c=99;c;)
b=r=>`${c||"No more"} bottle${c-1?"s":""} of beer${r?c--||"":" on the wall"}
`,x+=b()+b(1)+`Take one down, pass it around
`+b()
x
@ToJans don't forget to change ||
by |
142 chars!
x=""
b=r=>`${c|"No more"} bottle${c-1?"s":""} of beer${r?c--|"":" on the wall"}
`
for(c=99;c;)x+=b()+b(1)+`Take one down, pass it around
`+b()
You can't change ||
by |
, or the last sentence is wrong; so back to 143 chars...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@abdullin yeah, ReferenceError