Created
September 16, 2013 23:51
-
-
Save stevencombs/6588274 to your computer and use it in GitHub Desktop.
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
// Javascript Getting Started with Programming | |
// A Codecademy Javascript (…And the good!) assignment | |
// Dr. Steven B. Combs, coding novice | |
for (var x = 1; x < 21; x++){ | |
if (x % 3 === 0 && x % 5=== 0){ // If number divisible by 3 and 5 | |
console.log("FizzBuzz"); // Print 'FizzBizz' | |
} | |
else if (x % 3 === 0){ // If number divisible by 3 | |
console.log("Fizz"); // Print 'Fizz' to the console | |
} | |
else if (x % 5 === 0){ // If number divisible by 5 | |
console.log("Buzz"); // Print 'Buzz' to the console | |
} | |
else{ | |
console.log(x); // Print the number only | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment