[thelist] recursive JS function?

Ben Henick persist1 at io.com
Mon Feb 19 19:08:37 CST 2001


On Mon, 19 Feb 2001, Erik Mattheis wrote:

> Short: I have an array of deeply nested arrays. Can someone show me a 
> JavaScript function which will access all arrays within the tree of 
> arrays, even if I don't know how deep the tree is? Can this function 
> start digging into the array from an arbitrary point?

for (i = 0; i < Array1.length; i++)
{
	for (j = 0; j < Array1[i].length; j++)
	{
		//Whatever you want
	}
}

The permutations on this are fairly without limit.

Does this help?


-- 
Ben Henick
Web Author At-Large
http://www.io.com/persist1/
persist1 at io.com

"Are you pondering what I'm pondering, Pinky?"
"I think so, Brain, but... (snort) no, no, it's too stupid."
"We will disguise ourselves as a cow."
"Oh!" (giggles) "That was it exactly!"





More information about the thelist mailing list