how you have it will work as long as some_Function is called before some_Other_Function.
when you don't use the var keyword, you create not a local, but a global variable.
var_Local = some_Value; //makes global
var Local = some_Value; //makes local
since the value of the variable is set inside of some_Function, it must be called in order for the variable to be set as expected.
there is a third category, protected.
these are like globals except they live inside of a parent function that encloses both of the other functions.
a fourth option is an object property.
i recommend using these instead of globals whenever possible.
you can simply tack the variable onto the function object it lives in:
- function some_Function() {
-
somecode....;
-
var Local = "some_Value";
- some_Function.Local = Local;
-
}
you can then access the variable from any function like this:
- function some_Other_Function() {
-
alert(some_Function.Local);
-
}