Skip to content

Instantly share code, notes, and snippets.

@stevencombs
Created September 16, 2013 23:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevencombs/6588274 to your computer and use it in GitHub Desktop.
Save stevencombs/6588274 to your computer and use it in GitHub Desktop.
// 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