I would expect both x and y to be declared as local variables but y is declared as a global variable.
From what I've read both x and y should be local variables available only within the function they are declared in.
If "var x,y;" format is used they are declared as local variables as expected.
Just curious if anyone has any insight about this.
Wayne
From what I've read both x and y should be local variables available only within the function they are declared in.
If "var x,y;" format is used they are declared as local variables as expected.
Just curious if anyone has any insight about this.
PHP Code:
debugClear();
function preMain(){
setPriceStudy(true);
}
function main(){
var x=y=null;
var a,b;
x=1;
y=2;
a=3;
b=4;
testIt();
}
function testIt(){
//debugPrintln("13: x: "+x);//returns undefined variable error as expected
debugPrintln("14: y: "+y);//returns "14: y: 2"
//I would expect an undefined variable error for y also
//debugPrintln("17: a: "+a);//returns undefined variable error as expected
//debugPrintln("17: b: "+b);//returns undefined variable error as expected
}
Comment