Help


#1

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

What's wrong please help with the last part?


#2

you missed ; after console.log


#3

that's not the problem


#4

that's not the problem

it's syntax error.

did you have error message? post your full code and error message.


#5

the fizz and buzz statement is supposed to be the very first it isn't supposed to be and else if


#6

Not only you didn't finish your code with }; which can also be a problem


#7

Something like this
for( var i=1; i<21; 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);
}

};


#8

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