And the good!


#1


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


"Oops, try again. It looks like you printed out the wrong number of items."


Replace this line with your code. 
for (var i = 1; i >= 20; i ++) {
    
    if (i % 3 === 0) {
        console.log("Fizz");
    } 
    else if (i % 5 === 0 && i % 3 === 0) {
        console.log("FizzBuzz");
    } 
    else if (i % 5 === 0) {
        console.log("Buzz");
    } 
    else {
        console.log (i);
    }
}


#2

your code doesn't print anything? So there is a problem with your loop condition, given it evaluate to false in the first run of the loop


#4

your code should look like this.
I'm just starting out as well i could be wrong but for this certain problem -
i don't believe it's necessary to put "var" my code ran fine but i see a lot of people putting "var"
if any veteran see's this & I'm wrong or right I'd like to know lol the tiniest of errors could cause problems lol

for(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);
}
}

by the way remember that the ending digit should go one over. meaning if it ends at 20 your code should read 21. if it ends at 21 your code should read 22.


#5

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