Javascript split to split string in 2 parts irrespective of number of spit characters present in string
<p>I want to split a string in Javascript using split function into 2 parts.</p>

<p>For Example i have string:</p>

<pre><code>str='123&amp;345&amp;678&amp;910'
</code></pre>

<p>If i use the javascripts split, it split it into 4 parts.
But i need it to be in 2 parts only considering the first '&amp;' which it encounters.</p>

<p>As we have in Perl split, if i use like:</p>

<pre><code>($fir, $sec) = split(/&amp;/,str,2)
</code></pre>

<p>its splits str into 2 parts, but javascript only gives me:</p>

<pre><code>str.split(/&amp;/, 2);
fir=123
sec=345
</code></pre>

<p>i want sec to be:</p>

<pre><code>sec=345&amp;678&amp;910
</code></pre>

<p>How can i do it in Javascript.</p>
