![]() |
|
|
+ Search |
![]()
|
Oct 24th, 2000 22:17
Tim Powell,
To make sure that a variable is only available in a function, you need
to use the var keyword when declaring it.
j = 20;
i = 10;
function func()
{
i = 1; // Changed the value of global variable (since it exists)
var j = 1; // local variable - j is still 20 outside this function
}