You printer Fizzbuzz instead of printing Fizzbuzz


#1



Fizzbuzz module


I'm not sure how to interpret this error.... It LITERALLY says "You printer Fizzbuzz instead of printing Fizzbuzz".... um... what?!


for(i=1;i<=20;i++){
    if(i%3 === 0){
        if(i%5 === 0){
            console.log("Fizzbuzz");
        }else{
            console.log("Fizz");
        };
        
    }else if(i%5 === 0){
        if(i%3 === 0){
            console.log("Buzz");
        }else{
        console.log("Buzz");
        };

    }else{
        console.log(i);
    }
    
}


#2

This is a bit all over the place, your way works but there is a neater way :slight_smile:

So you go your loop to begin with which is fine.

First you want to compare if i is divisible by 3 and && 5 and make it print "fizzBuzz"

if not divisible by both then compare it to i % 3 and make it print "Fizz"

and if not divisible by 3 make it check if its divisible by i % 5 and to print "Buzz"

else make it print i

See if you can build off what I've said.


#3

Hi I think that the erro is that you should print

FizzBuzz

instead of 

Fizzbuzz

#4

Darn it I was so sure I had found a bug... and I'm quickly finding that 99% of the issues I have are solved by capitalizing one letter or using a comma where it should have been a semicolon...

I think I tried doing a cleaner nested statement but kept getting errors, I was trying to do:

if(i%3 && i%5 ===0){

}

and kept getting errors, but will try it again, thanks for the quick response and the tips!


#5

Very close with that

if(i % 3 === 0 && i % 5 === 0) {
console.log("FizzBuzz")
} else if {


#6

Thank you, I am hoping to start thinking like that on the fly, I knew while I was typing all that code that I was probably doing it in the most inefficient way possible but that's how I like to do things!


#7

I had the same exact problem thanks!