From 48de26bf8e1ea2bfd60bd73d9bfd9e952727695e Mon Sep 17 00:00:00 2001 From: Connor Stokes Date: Mon, 23 Sep 2024 15:22:36 +0100 Subject: [PATCH] done --- src/fizzbuzz.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/fizzbuzz.js b/src/fizzbuzz.js index e3ec3a8..f37cf94 100644 --- a/src/fizzbuzz.js +++ b/src/fizzbuzz.js @@ -1,7 +1,18 @@ 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); + } + } +