Created
June 23, 2015 23:54
-
-
Save jdfm/77915ce05164746dad48 to your computer and use it in GitHub Desktop.
use a for switch block to implement a fizz buzz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for ( var i = 1; i <= 100; i++ ) switch ( true ) { | |
case !( i % 3 ) && !( i % 5 ): console.log('fizzbuzz', i); break; | |
case !( i % 3 ): console.log('fizz', i); break; | |
case !( i % 5 ): console.log('buzz', i); break; | |
default: | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment