Javascript: gradually adding to string in each iteration?
<p>I have a string like this that is split up:</p>

<pre><code>var tokens = "first&gt;second&gt;third&gt;last".split("&gt;");
</code></pre>

<p>What I would like in each iteration is for it to return</p>

<pre><code>Iteration 0: "last"
Iteration 1: "third&gt;last"
Iteration 2: "second&gt;third&gt;last"
Iteration 3: "first&gt;second&gt;third&gt;last"
</code></pre>

<p>I am thinking of using decrementing index for loop.... but is there a more efficient approach ?</p>

<pre><code>for (int w = tokens.length-1; w == 0; w--)
{

}
</code></pre>
