Head-First-JavaScript-Programming icon indicating copy to clipboard operation
Head-First-JavaScript-Programming copied to clipboard

Global Variable.

Open adityathebe opened this issue 10 years ago • 1 comments

I see that we need to declare the variable "i" in the for loop using the keyword "var". example for ( var i = 0 ; i <scores.length ; i++)

As I have learned in the previous lessons that if I don't declare a variable inside a function it becomes a global variable. What if I don't write var in front of i? Does that make it a global variable??

adityathebe avatar Jul 22 '15 06:07 adityathebe

Yes, it does!

bethrobson avatar Jul 22 '15 18:07 bethrobson