3. and the good


#1



https://www.codecademy.com/courses/spencer-sandbox/0/3?curriculum_id=506324b3a7dffd00020bf661

Below is the code I am currently working on however the console keeps giving me the error message of
"syntaxerror : unexpected token else"

Any help would be great! :3


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


#2

The proper keyword is:

else if

Not

if else

#3

I've corrected that mistake however it still isn't working


#4

Post your updated code please.

You may've corrected it the wrong way.


#5

Hope this helps some, I marked the things I changed with comments to help the code run.

/*Remove the ; after the parameters, it's used to separate arguments, not the function from params*/    
for(var i = 1; i < 21; i++); {
/* I would recommend setting each argument in parenths i.e. ((i % 3 === 0) && (i % 5 ===))
        if (i % 3===0 && i % 5 === 0) {
            console.log("FizzBuzz");
        }
/* Add two or three equals signs to these "else if" statements*/
        else if (i % 5 = 0) {
            console.log("Buzz");
        }
         else if (i % 3 = 0) {
            console.log("Fizz");
        }else {
            console.log(i);
        }
    };