# And the good!

#1

Can anybody tell my who it does not work?

for (var i = 0; i < lista.length; i++) {

``````if ((i % 3 === 0 ) && (i % 5 !== 0)) {
console.log("Fizz");
}
else if ((i % 5 === 0) && (i % 3 !== 0)) {
console.log("Buzz");
}

else if ((i % 3 === 0 ) && ( i % 5 === 0 )) {
console.log("FizzBuzz");
}
else {
console.log(i);
}``````

}

#2

What's it doing differently from what you want?

#3

if I start from i = 1 and add 1 to length it works, otherwise it prints FizzBuzz instead of 1 :

for (var i = 1; i < lista.length + 1; i++) {

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

else {
console.log(i);
}``````

}

#4

Didn't it print FizzBuzz instead of 0? Because that's what you started counting at

or is there some array or list that you're iterating through? Which one, it isn't included in your code.

But you're not looking at the elements in that list, you're doing all your comparisons to `i`

#5

that is 1) the whole code:

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

for (var i = 0; i < lista.length; i++) {

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

else {
console.log(i);
}``````

}

2) an error with appears: You printed FizzBuzz when you should have printed 1

3) and what is printed:
izzBuzz
1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz
16
17
Fizz
19

I do not understand why it does not work

#6

OK, now I got it, "you're doing all your comparisons to i", thank you for help! Seems that I need to get rest a little