Skip to content

Commit

Permalink
completed fizzbuzz
Browse files Browse the repository at this point in the history
  • Loading branch information
DagAndreas committed Sep 23, 2024
1 parent 164ec37 commit b7b7dbc
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/fizzbuzz.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,23 @@ const answer = []

// Write your code below this line

const fizz = 3
const buzz = 5

for (let i = 1; i <= 15; i++){
if (i % fizz === 0 && i % buzz === 0){
answer.push('FizzBuzz')
}
else if (i % fizz == 0){
answer.push('Fizz')
}
else if (i % buzz == 0){
answer.push('Buzz')
}
else {
answer.push(i)
}
}



Expand Down

0 comments on commit b7b7dbc

Please sign in to comment.