Skip to content

Commit

Permalink
Update fizz-buzz.js
Browse files Browse the repository at this point in the history
  • Loading branch information
sigilworks committed Jan 8, 2013
1 parent 75f4fc6 commit 741ac8e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fizz-buzz.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
// 113 characters
!function(a,b,i,r){while(i<100)r=d=e=i,d%=5,e%=3,console.log([r,!d&!e?a+b:!d?b:!e?a:'']+''),++i}('fizz','buzz',1)

// 109 characters, by switching strategies
// The Google Closure Compiler (adv. mode) did this in 109 characters,
// but I think it's an illegitimate solution, as it's just a code fragment, not a standalone function.
for(var a=1,b;100>a;)b=d=e=a,d%=5,e%=3,console.log([b,!d&!e?'fizzbuzz':!d?'buzz':!e?'fizz':'']+''),++a

0 comments on commit 741ac8e

Please sign in to comment.