How to select an item from a javascript tree array?
<p>I have a javascript array which defines an infinite tree like this.</p>

<pre><code>z=['~GROUPHEAD 0~',
    'Intro',
    'Summary',
    ['~GROUPHEAD 1~',
        'Do this',
        ['~GROUPHEAD 2~',
            'Task 1',
            'Task 2'
        ]
    ]
]
</code></pre>

<p>Now<br>
<code>z[0]='~GROUPHEAD 0~';</code><br>
<code>z[1]='Intro';</code><br>
<code>z[2]='Summary';</code><br>
<code>z[3][0]='~GROUPHEAD 1~';</code><br>
<code>z[3][1]='Do this';</code><br>
<code>z[3][2][0]='~GROUPHEAD 2~';</code><br>
<code>z[3][2][1]='Task 1';</code><br>
<code>z[3][2][2]='Task 2';</code><br>
<code>z...[0] is a Header</code>  </p>

<h1>Problem</h1>

<p>I want to send a number say <code>322 or 3.2.2 or [3][2][2]</code> to select 'Task 2' (i.e. <code>z[3][2][2]</code>)<br>
Can anyone help; also is there a better way to do this?  </p>

<h2>Edit</h2>

<p>I need to call it 100s of time</p>
