And the good help needed


#1


I'm stuck at "and the good" and don't know what's wrong with my code. I'm getting a "your code doesn't look right" message.


for (i = 1, i<21, 1++) {
    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);
    }
};


#2

for (i = 1; i<21; 1++)


#3

You have a mistake in your first line - for (i = 1, i<21, 1++)

it should be for (i = 1, i<21, i++)

and then the if statement - if (i % 3 === 0 && i % 5 === 0)

should be ((i % 3 === 0) && (i % 5 ===0))


#4

Thanks everyone. I reset my code and started from scratch and was able to pass without problem, but will now remember not to put a curly bracket in a for loop. Thanks


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.