From 2b5af4b484f1e528e86984211d9aa7c037ae3be0 Mon Sep 17 00:00:00 2001 From: NetMan <13informatyka14@gmail.com> Date: Tue, 2 Jan 2024 19:47:01 +0100 Subject: [PATCH] Added FizzBuzz to nums divisible by 3 and 5 --- index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 4fdbc9a..f37ad6b 100644 --- a/index.js +++ b/index.js @@ -3,5 +3,10 @@ if (isNaN(number)) { alert("Not a number, refreshing"); location.reload(); } else { - + for (let i = 1; i <= number; i++) { + output = ""; + if (i % 3 === 0) (output += "Fizz"); + if (i % 5 === 0) (output += "Buzz"); + console.log(output); + } } \ No newline at end of file