I have declared my array globally like so:
window.onload = function(){
var test = 'test';
var sel = new Array();
login_check();
};
Everything pretty much is inherited from login_check()
function in my engine. The problem is whilst var test
is set var sel
is not set when i use it in a function.
I use this in my function :
console.log(test); //displays as intended
if(sel.length > 0){ //ERROR Uncaught ReferenceError: sel is not defined
//do something
}
I should mention sel is normally empty at this point. Does JS some how not allow global arrays to be set?