# FizzBuzz HELP!

#1

When I run this code it prints out exactly what it is supposed to but with an "undefined" at the very bottom.

And then it gives this error--> "ops, try again. It looks like you printed out the wrong number of items."

I dont know where its getting the undefined from? And it is printing out exactly what it wanted me to, so whats am I missing?

Here are the instructions below

Print out the numbers from 1 - 20.
The rules:
For numbers divisible by 3, print out "Fizz".
For numbers divisible by 5, print out "Buzz".
For numbers divisible by both 3 and 5, print out "FizzBuzz" in the console.
Otherwise, just print out the number.

var numbers=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20];

function FizzBuzz() {

for (var i=1;i<21;i++){
if (numbers[i]%3===0 && numbers[i]%5===0){
console.log("FizzBuzz");
} else if (numbers[i]%3===0){
console.log("Fizz");
} else if (numbers[i]%5===0){
console.log("Buzz");
} else {

``````                   console.log(i);

}``````

}
};

console.log(FizzBuzz());

#2

don't add console.log to the function call, this will cause an additional log to the console

#3

That was it! I also was using numbers[i] to call from the var numbers array, but that was causing an error message saying that the number 2 should have printed "Fizz". When I used only var i it ran correctly....even though it was logging the same way as numbers[i] for some reason

#4