Added FizzBuzz to nums divisible by 3 and 5

This commit is contained in:
NetMan 2024-01-02 19:47:01 +01:00
parent 7f67c9ee95
commit 2b5af4b484
1 changed files with 6 additions and 1 deletions

View File

@ -3,5 +3,10 @@ if (isNaN(number)) {
alert("Not a number, refreshing"); alert("Not a number, refreshing");
location.reload(); location.reload();
} else { } else {
for (let i = 1; i <= number; i++) {
output = "";
if (i % 3 === 0) (output += "Fizz");
if (i % 5 === 0) (output += "Buzz");
console.log(output);
}
} }