3/33, It looks like you printed out the wrong number of items


#1

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

var Fizzbuzz = function print() {

for (var J = 0; J > 20; J++){

if (J % 3 === 0) {
console.log("Fizz");
} else if(J % 5 === 0){
console.log("Buzz");
} else if (J % 5 === 0 && J % 3 === 0) {
console.log ("FizzBuzz");
} else {
console.log(J);
}

}

};

What do I do?


3/33 Oops, try again. It looks like you printed out the wrong number of items
#2

in your for line, change J > 20 to J < 20


#3

With
var numbers = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
you created a numbers Array.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array

To get the 1st Array-Element of the numbers Array
you use
numbers[0]

and to get all Elements with a for-loop you will have to start
at Element-zero
like

for (var x = 0; x < numbers.length ; x++ ) {
   console.log( number[x] );
}

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for


#4

Always place the most-specific-condition at the TOP of your IF ELSE-IF ELSE statement structure !!


#5

if u have problem:
for(i=1; i<=20; i++)
{
if(i%3 === 0 && i%5 === 0)
{
console.log("FizzBuzz");
}
else if(i%3 === 0)
{
console.log("Fizz");
}
else if(i%5 === 0)
{
console.log("Buzz");
}
else
{
console.log(i);
}
}


#6

Worked for me! Thank you so much!