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?
I am not sure what you were trying to accomplish, but I was able to make several modifications and was able to access the global variable in this example: http://jsfiddle.net/pKU6A/