Codesnipp.it Social Code Sharing

Richie Rich

My solution to #codeyear week 5 FizzBuzz using nested conditionals

by Richie Rich on Feb 07, 2012

var i; for (i=1; i<=20; i++) { if (i % 3 === 0) { if (i % 5 === 0) { console.log("FizzBuzz"); } else { console.log("Fizz"); } } else if (i % 5 ===0) { console.log("Buzz"); } else { console.log(i); } }

Can't see the comments? Please login first :)