Created
November 23, 2017 15:51
-
-
Save htkcodes/828c4a836ddbbc8a0dc57b0af728b812 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/*jshint esversion: 6 */ | |
/* | |
Write a algorithm that prints the numbers from 1 to n. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz” | |
*/ | |
fizz(10); | |
function fizz(number) { | |
for (let z = 1; z < number; z++) { | |
0 === z % 15 ? console.log("FizzBuzz"): 0 === z % 3 ? console.log("Fizz"): | |
0 === z % 5 ? console.log("Buzz"): console.log(z); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment