3....And the good!


#1

var i=0;
for(i=1;i<21;i++){
console.log(i);
}
if(i%3===0){
console.log('Fizz');
}
if else(i%5===0){
console.log('Buzz');
}
if else(i%3===0&&i%5===0);
console.log('FizzBuzz');
}
else{
console.log(i);
}
};

SyntaxError: Unexpected token else

Why it doesn't work?(


#2

because it is else if, not if else?

a number which is divisible by 3 and 5 is also divisible by 3 or 5, so to check if a number is divisible by both, should come first


#3

Thank you! i solved it


#4