Javascript: gradually adding to string in each iteration ?
Posted
by
Kim Jong Woo
on Stack Overflow
See other posts from Stack Overflow
or by Kim Jong Woo
Published on 2011-01-17T03:31:02Z
Indexed on
2011/01/17
3:53 UTC
Read the original article
Hit count: 267
JavaScript
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--)
{
}
© Stack Overflow or respective owner