Using modal box. Refresh the page to enter different number.
function fizzbuzz (n) {
let text = "";
for (let i = 1; i <= n; i++) {
if (i%3 === 0 || i%5 === 0) {
if (i%3 === 0) {
text += "Fizz";
}
if (i%5 === 0) {
text += "Buzz";
}
} else {
text += i;
}
text += " ";
}
alert (`FizzBuzz of ${n}:\n${text}`);
}
let number = prompt("Number to FizzBuzz:");
fizzbuzz(number);