3...And the good


#1


for (var i=1; i<=20; i++) {
    console.log(i);
    var three = i / 3;
    var three1 = three % 1;
    var five = i / 5;
    var five1 = five % 1;
    if (i === 15) {
        console.log("FizzBuzz")
    }
    else if (three1 === 0) {
        console.log("Fizz")
    }
    else if (five1 === 0) {
        console.log("Buzz")
    }
};

it do what it may but it says: "Oops, try again. It looks like you printed out the wrong number of items."

01.Print out the numbers from 1 - 20. The rules:

02.For numbers divisible by 3, print out "Fizz".
For numbers divisible by 5, print out "Buzz".
For numbers divisible by both 3 and 5, print out "FizzBuzz" in the console.
Otherwise, just print out the number.


#2

Otherwise, just print out the number.

So it seems that this line:

console.log(i);

should be moved to the else statement.


#3

thanks i didnt knew what means and i thought that it is not important very thanks


#4

You're very welcome :slight_smile:


#5

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