20 lines
412 B
TypeScript
20 lines
412 B
TypeScript
function fizzBuzz(stopNumber: number) {
|
|
let 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);
|