Hacker News new | ask | show | jobs
by xymostech 4934 days ago
I came up with

    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.
2 comments

I knew I could also drop the "var ", but I like to operate within the 140bytes challenge rules that say you're not allowed to leak into the global scope. I'll give you the 3 chars from the parens and semicolon, though - I got caught up with the idea of "hey, you can do this whole thing inside the for statement itself!" back when I did this!
Mine was almost identical, except with i++<100 instead of ++i%3? etc. Also 64 characters.

But is there really no way to end the ternary operators without parenthesis?