3. any 1 can spot the problem?


#1

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

};

i did the same as the instruction ask, any1 know what is the problem?


#2

Hi here

for (var i = 1; i < 21; i++) {
console.log(i);

Just remove the console.log(i);


#3

but the instructions ask to print all the number from 1-20? the first instruction


#4

Yes and thats why you're doing it here. If it's not divisible by 3 or 5 it will then just output the number to the console.


#5

yea i got it, but dont know why they ask then to print first of all the number 1-20... well thanks anyways!