D
drew
this appears to work:
//Step 1 - I globally defined K
var K = new Array(150);
for (var i = 0; i < 150; i++) { K = new Array(150);}
//Step 2 I call this function without the var before K
function function1()
{
K[149][149]=7;
K = new Array(1000);
for (var i = 0; i < 1000; i++) { K = new Array(1000);}
}
//Step 3 - I called function2 - all seems to work
function function2()
{
K[200][200]=7;
var text1 =K[200][200];//undefined - which is fine - hoping it garbage collected
var text2 =K[200][200];//7 - It seemed to work!
}
Will I run into trouble with this?
thank you
//Step 1 - I globally defined K
var K = new Array(150);
for (var i = 0; i < 150; i++) { K = new Array(150);}
//Step 2 I call this function without the var before K
function function1()
{
K[149][149]=7;
K = new Array(1000);
for (var i = 0; i < 1000; i++) { K = new Array(1000);}
}
//Step 3 - I called function2 - all seems to work
function function2()
{
K[200][200]=7;
var text1 =K[200][200];//undefined - which is fine - hoping it garbage collected
var text2 =K[200][200];//7 - It seemed to work!
}
Will I run into trouble with this?
thank you