I need to create global two dimensional array in jquery or javascript
My function is like this
<script>
var globalArray[0] = new Array();
function createArray(){
alert(globalArray[0]);
}
</script>
<div><input type='button' value='save' onclick='createArray();'> </div>
On click of that button I am getting this error "globalArray[0] is undefined"
How can I create global dynamic multi dimensional array.
You have a typo with the dot:
Change to:
What are you trying to do with this code?
Update: (The question was totally edited.)
Your code:
globalArray[0]is invalid variable name, you need first to declare the array: