Extjs/js multidemensional array convert to string
<p>I'm having a difficulty to construct a specific string from multidimensional array.
<br/><br/>This is my array:<br/>
<code>[[{query:'number:1', operand:''},
[{query:'number:2', operand:'&amp;&amp;'},{query:'number:3', operand:'&amp;&amp;'}]],
[{query:'number:4', operand:'||'},{query:'number:5', operand:'||'}]]</code>  </p>

<p>How do I construct a string from this array to become like this:</p>

<p><code>((number:1&amp;&amp;(number:2&amp;&amp;number:3))||(number:4||number:5))</code></p>

<p>I've create a recursive function however the result does not return as I expected. <br/>Here is my code:</p>

<pre><code>function queryRecursive(queArr){
var que='';
Ext.each(queArr, function(q,idx){
    if(Ext.typeOf(q)==='array'){
        que+=me.queryRecursive(q);
    }else{
        if(idx===0){
            if(q.operand===''){
                que +=q.operand+q.query;
            }else{
               que +=q.operand+'('+q.query;
            }
        }else if(idx===queArr.length-1){
            que +=q.operand+q.query+')';
        }else{
            que +=q.operand+q.query;
        }
    }
});
return que;
}
</code></pre>

<p><br/>Here is the return result:</p>

<p><code>number:1&amp;&amp;(number:2&amp;&amp;number:3)||(number:4||number:5)</code></p>