From c28b090c98a893b08ac7e99bdd391d85ac82f4d6 Mon Sep 17 00:00:00 2001 From: Muzea001 Date: Mon, 23 Sep 2024 09:21:23 +0200 Subject: [PATCH] Test successfull --- src/fizzbuzz.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/fizzbuzz.js b/src/fizzbuzz.js index e3ec3a8..6cce89c 100644 --- a/src/fizzbuzz.js +++ b/src/fizzbuzz.js @@ -1,10 +1,18 @@ const answer = [] // Write your code below this line - - - - - +// Loop through numbers from 1 to 15 +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 { + // Otherwise, push the number itself + answer.push(i) + } +} // Don't touch the code below this line, we'll cover it later module.exports = answer