Cant crack FizzBuzz


#1


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


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


Need explain for this trial:

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


#2

Firstly you don't want to print 0 as the question says " 01. Print out the numbers from 1 - 20." So you want to type x=1 in your loop.

You need something in your else. Remove this console.log(x); from the top and put it in your else. You want to do this in your else because you are saying if nothing above was found print the number.

Let me know if that solved it or if you need further explanation.


#3

great, that x things truly my prob,
thx for your effort :grin:


#4

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