Click to See Complete Forum and Search --> : stack overflow when creating a 2d array


bisqui
01-10-2003, 04:18 PM
I'm getting a stack overflow in the following code. I tried setting the navArray size to 6 in the declaration but that didn't help. Any ideas?

var pages = new Array("h", "n", "w", "r", "m", "c");
var navArray = new Array();

pageCount = pages.length;
for (i=0; i<pageCount; i++) {
page = pages[i];
navArray[page] = new Array();
}

swon
01-10-2003, 04:30 PM
could be that:

navArray[page] maybe you should use i instead of page
navArray[i] =

just a thought.

bisqui
01-10-2003, 04:34 PM
i stared at this for over an hour before I posted the question. Two minutes after I posted, I figured it out. Typical. It had nothing to do with the 2d array. There was a bit of code elsewhere that was being affected by a naming conflict.

swon
01-10-2003, 04:52 PM
Indeed a typical case of coding, figured after posting :)