3... and the good


#1

for(i=0;i<21;i++){
if(i%3===0){
console.log("Fizz");}

    else if(i%5===0){
        console.log("Buzz");}

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

}

what is wrong with my syntax?


#2

all that I could spot is that you don't have the "else" statement at the end...


#3

ahh yeah i got it

for(i=1;i<21;i++){

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


else if(i%3===0){
    console.log("Fizz");}

    else if(i%5===0){
        console.log("Buzz");}

    else{    

   console.log(i);}

}


#4

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