by Hupo · 13y ago · 0 comments
for(var i=0;i++<100;console.log(((i%3?'':'Fizz')+(i%5?'':'Buzz'))||i));
For anyone else interested in doing code golf with JavaScript, here's a goldmine of byte-saving techniques: for(i=0;i<100;)console.log((++i%3?"":"Fizz")+(i%5?"":"Buzz")||i)
earlier. 64 characters, because I don't have "var ", an extra set of parens, and a semicolon. Worse syntax, but hey, it's code golf.But is there really no way to end the ternary operators without parenthesis?