19 lines
407 B
JavaScript
19 lines
407 B
JavaScript
function fizzBuzz(stopNumber) {
|
|
var i = 1;
|
|
while (i < stopNumber + 1) {
|
|
if (i % 5 === 0 && i % 3 === 0) {
|
|
console.log('FizzBuzz');
|
|
}
|
|
else if (i % 3 === 0) {
|
|
console.log('Fizz');
|
|
}
|
|
else if (i % 5 === 0) {
|
|
console.log('Buzz');
|
|
}
|
|
else {
|
|
console.log(i);
|
|
}
|
|
i++;
|
|
}
|
|
}
|
|
fizzBuzz(30);
|