Skip to content

Commit

Permalink
done with exercise
Browse files Browse the repository at this point in the history
  • Loading branch information
alihaiderkhannn committed Sep 25, 2024
1 parent 164ec37 commit 933f61b
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

for (let i = 1; i < 16; 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)



Expand Down

0 comments on commit 933f61b

Please sign in to comment.