Am I Going About This All Wrong?


#1



I get SyntaxError: Expected ')'
Should I be listing out the numbers as an array instead? Thanks!


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


#2

There is no array needed.
Only a correct for loop

for(var i=1; i<=20; i++)
{
// more code here 
}

#3

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