I am working on google maps and I need to create an array of items. Here is my pseudo code:
<script>
var myvar=new array();
function initialize(){
for i=1 to 10
{
callAnotherFunct(i);
}
access myvar() here;
}
function callAnotherFunct(i){
myvar=array_element_i;
}
</script>
I am expecting myvar to behave as a global variable but it is not. I cannot get any values for myvar in the initialize().
What am I doing wrong here?
var myGlobalVar = {}and then use something likemyGlobalVar.myArray = new Array()Probably a namespace collision. I had the same issue and using a separate namespace seemed to work :)