I'm new to JavaScript, so I'm sorry if this question is too stupid. I was told that when you create a for-loop, you should write:
for (var i = 0; i < 10; i++)
but sometimes I forget to put var before the i:
for (i = 0; i < 10; i++)
and it works the same. Do I need to create the variable i?
What's the main difference between
var i = 0
and
i = 0
in a for-loop?
 
     
     
     
     
     
     
     
    