Don't know what I'm doing wrong


Her are my codes:
for (var i=1; i<21; i++){
if(i%3 === 0){
}else if(i%5 === 0){
}else if(i%3=== 0 && i%5 === 0){

please can you help me with a correct code and also show me what's wrong with mine?


well, you first check if the number is dividable by 3 and then if it is dividable by 5, which means your code will never get to this line:

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

because either this line:

if(i%3 === 0)

or this line:

else if(i%5 === 0)

has already ended the condition check, i suggest you change the order of your if statements