# Fizz Buzz in JS

This is a simple JavaScript Fizz Buzz solution based on a Codecademy exercise. I refactored it down a few lines after seeing these implementations.

I wanted to post here and see what else I can learn from this basic exercise.

for (var i = 1; i <= 20; i++) {
var result = "";
if (i % 3 === 0) { result = "Fizz"; }
if (i % 5 === 0) { result += "Buzz"; }
console.log(result || i);
}


It's a small detail, but in one of your if you're doing = and in the other one +=.
It works, but what you are saying is that when i % 5 = 0 it could be a regular assignation of Buzz or it could be the addition of Buzz to Fizz.
I notice it because you have two different ways of working with the string result. It's a small details and you don't really need to change it, but those are things you need to be aware of. I'm a bit paranoid and it's a big extrapolation, but when a program (other than a FizzBuzz) will change those difference have a chance to impact the development.