hi, possibly a stupid question coming up..
If I define a global var at the top of a script..
then later on call a func which uses the same var for its input..
is the function using a local var or the global var?
in PERL local scope is relative to where within the curly braces the variable resides, so that would make it the global var not a local var.
is it the same with JS?
or because it is defined within the function does it always make them local vars?
"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."
"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
If I define a global var at the top of a script..
Code:
var myGlobal = 'username';
then later on call a func which uses the same var for its input..
Code:
function myFunc(myGlobal){do whatever;}
is the function using a local var or the global var?
in PERL local scope is relative to where within the curly braces the variable resides, so that would make it the global var not a local var.
is it the same with JS?
or because it is defined within the function does it always make them local vars?
"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."
"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!