Javascript: gradually adding to string in each iteration ?
- by Kim Jong Woo
I have a string like this that is split up:
var tokens = "first>second>third>last".split(">");
What I would like in each iteration is for it to return
Iteration 0: "last"
Iteration 1: "third>last"
Iteration 2: "second>third>last"
Iteration 3: "first>second>third>last"
I am thinking of using decrementing index for loop.... but is there a more efficient approach ?
for (int w = tokens.length-1; w == 0; w--)
{
}