From aa3dddd774c94dc2c6c9dcec4e74e6e5bf2d1515 Mon Sep 17 00:00:00 2001 From: Valen98 Date: Mon, 23 Sep 2024 10:01:26 +0200 Subject: [PATCH] FizzBuzz finished --- src/fizzbuzz.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/fizzbuzz.js b/src/fizzbuzz.js index e3ec3a8..2072f24 100644 --- a/src/fizzbuzz.js +++ b/src/fizzbuzz.js @@ -1,7 +1,20 @@ const answer = [] // Write your code below this line +for( let i = 1; i <= 15; 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)