# My head wrapped in FizzBuzz

As a junior software developer, I have been practicing some data structure questions and algorithms. I have also been completing some code challenges such as the FizzBuzz challenge. This challenge has been credited with being one of the main questions asked during a coding interview. So here’s my take on it. First let’s look at the qualifications to complete this challenge. In order to complete this challenge, the candidate must write a function that will output(keyword) an array of numbers. If a number is divisible by 3 then the word “Fizz” should be output. If a number is divisible by 5 then the word “Buzz” should be output. If a number is both divisible by 3 and 5 then the word “FizzBuzz” should appear. The way I approached this challenge was to start by creating a variable and setting it to an empty array. Something like var output = []; works fine. Then I set a variable of count to equal one like so: var count = 1;. Then comes the function and logic. There are many ways that someone can approach this challenge but for me I went with and if/else method. The first if statement is asking if the count is divisible by 3 && if the count is divisible by 5 and if so then we should “push” onto the output the word “FizzBuzz”. Else if the count is divisible by 3 alone, push the word “Fizz” into the array. Else if the count is divisible by 5 alone, push the word “Buzz” into the array. Else just push the count. We finish this off with a count++ so the count keeps incrementing by 1. I then did a console.log of the output to see what would happen and voila! Shown below is the full code snippet! I hoped this helps anyone struggling with this challenge.