From 933f61b9d5ce9a6fed04a9bec3b2e6a2db0a1172 Mon Sep 17 00:00:00 2001 From: Ali Haider Khan Date: Thu, 26 Sep 2024 00:00:01 +0200 Subject: [PATCH] done with exercise --- src/fizzbuzz.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/fizzbuzz.js b/src/fizzbuzz.js index e3ec3a8..d140865 100644 --- a/src/fizzbuzz.js +++ b/src/fizzbuzz.js @@ -2,7 +2,23 @@ const answer = [] // Write your code below this line +for (let i = 1; i < 16; i++){ +if(i % 3 === 0 && i % 5 === 0){ + answer.push('FizzBuzz') +} +else if (i % 3 === 0) { + answer.push('Fizz') +} +else if (i % 5 === 0){ + answer.push('Buzz') +} +else { + answer.push(i) +} +} + +console.log(answer)