First, your loop is not even getting off the ground:
for ( i = 1; i > 20; i++ )
will not iterate even once since the middle condition is initially false. I think you meant:
for ( i = 1; i <= 20; i++ )
"FizzBuzz";
is just a string literal that JavaScript is ignoring. You need to output this string somehow:
console.log("FizzBuzz");
Also, this block
else {
i;
}
is also not doing anything. Did you want to display numbers that were divisible by neither 3 nor 5?
else {
console.log(i);
}
And, on a similar note, what is the "hello"
at the top loop supposed to do?
On a more positive note, I see you're using strict equality:
if ( i % 5 === 0 )
this is a very, very good habit to be in. The non-strict equality operator == will do all sorts of implicit conversions if you're not careful. Always use strict equality unless you purposefully want these implicit conversions to happen.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…