Added FizzBuzz to nums divisible by 3 and 5
This commit is contained in:
parent
7f67c9ee95
commit
2b5af4b484
7
index.js
7
index.js
|
@ -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);
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue