Is there a list like operator in javascript?
<p>I'm now implement such a task:I need to convert PHP variables to javascript</p>

<pre><code>$arr['name1'] = 'value1';
$arr['name2'] = 'value2';
</code></pre>

<p>so that after processing,should be:</p>

<pre><code>&lt;script type="text/javascript"&gt;
var name1 = 'value1';
var name2 = 'value2';
...
</code></pre>

<p>I hoped to do it this way:</p>

<pre><code>&lt;script&gt;
list(&lt;?php echo join(',',array_keys($arr)?&gt;) = &lt;?php echo json_encode(array_values($arr));?&gt;
</code></pre>
