From 9ded304abe6d229f83cd05db406c2b834551b7b4 Mon Sep 17 00:00:00 2001 From: Julia Date: Tue, 24 Sep 2024 14:37:48 +0200 Subject: [PATCH] Complete exercise --- src/fizzbuzz.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/fizzbuzz.js b/src/fizzbuzz.js index e3ec3a8..7d210fe 100644 --- a/src/fizzbuzz.js +++ b/src/fizzbuzz.js @@ -1,7 +1,21 @@ const answer = [] // Write your code below this line - +for (let i = 1; i <= 15; i++) { + + if(i % 5 === 0 && i % 3 === 0) { + answer.push("FizzBuzz") + } + else if(i % 3 === 0) { + answer.push("Fizz") + } + else if(i % 5 === 0) { + answer.push("Buzz") + } + else { + answer.push(i) + } +}