Cannot set property '3' of undefined in 2 dimensional array
I am trying to create a 2 dimensional array but am getting this error.

I loop an object and try to assign them but it won't let me assign a value to the second dimension.

This is what i have:

    //this is globally set
    var gcollision = new Array();

    function create(){
		for (var X in sdata) {
			X = parseInt(X);
			for (var Y in sdata[X]) {
				Y = parseInt(Y);
				width = parseInt(sdata[X][Y][2]);
				height = parseInt(sdata[X][Y][3]);
	for (i=X; i!= X+width; i++) {
       //error occurs here "Uncaught TypeError: Cannot set property '3' of undefined"
					 gcollision[i][Y] = 1
				
    for (j=Y; j!=Y+height; j++) {
					 gcollision[X][j] = 1
					}
				}
			}
		}

How do i make it set the value of properly?
Cannot set property '3' of undefined in 2 dimensional array
===

I am trying to create a 2 dimensional array but am getting this error.

I loop an object and try to assign them but it won't let me assign a value to the second dimension.

This is what i have:

    //this is globally set
    var gcollision = new Array();

    function create(){
		for (var X in sdata) {
			X = parseInt(X);
			for (var Y in sdata[X]) {
				Y = parseInt(Y);
				width = parseInt(sdata[X][Y][2]);
				height = parseInt(sdata[X][Y][3]);
	for (i=X; i!= X+width; i++) {
       //error occurs here "Uncaught TypeError: Cannot set property '3' of undefined"
					 gcollision[i][Y] = 1
				
    for (j=Y; j!=Y+height; j++) {
					 gcollision[X][j] = 1
					}
				}
			}
		}

How do i make it set the value of properly?