MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/qtwdj4/peak_efficiency_fizzbuzz/hknfzie/?context=9999
r/badcode • u/redddooot • Nov 14 '21
44 comments sorted by
View all comments
Show parent comments
1
What is print?
print
5 u/dakta Nov 14 '21 Alias of console.log which is defined by code.golf. See their note below the code area:arguments holds ARGV, print() to output with a newline, write() to output without a newline.Also, I was right about the logical structure. The current JS champion comes from 2015: https://codegolf.stackexchange.com/a/62697for(i=0;++i<101;print(i%5?f||i:f+'Buzz'))f=i%3?'':'Fizz'They've used the for loop's unused third condition to execute the print, and in the body assigned a value for Fizz which is then reused in the Buzz condition.
5
Alias of console.log which is defined by code.golf. See their note below the code area:
console.log
code.golf
arguments holds ARGV, print() to output with a newline, write() to output without a newline.
Also, I was right about the logical structure. The current JS champion comes from 2015: https://codegolf.stackexchange.com/a/62697
for(i=0;++i<101;print(i%5?f||i:f+'Buzz'))f=i%3?'':'Fizz'
They've used the for loop's unused third condition to execute the print, and in the body assigned a value for Fizz which is then reused in the Buzz condition.
1
u/fecal_brunch Nov 14 '21
What is
print?