[Javascript] I have hit a brick wall
Scott Reynen
scott at randomchaos.com
Thu Sep 7 16:09:44 CDT 2006
On Sep 7, 2006, at 3:06 PM, joel.goldstick at columbuswebmakers.com wrote:
>> i.push(i.shift());
> While the looping methods outlined may be easier to understand,
> this line of code is a gem! My guess is that it also runs faster.
> No need to know how many items in the array either.
>
> So, if this looks strange, do a little study on stacks and lists.
> These are long time standard constructs for those who studied
> programming in college courses, but are most likely missed by the
> many who are learning to code by the seat of their pants!
While the above code is ideal for arrays, DOM nodes are in a tree,
not an array. The general concept could still be applied if you know
in advance the exact structure of the DOM tree, as Jonathon said, but
that doesn't seem to be the case for this particular problem.
Peace,
Scott
More information about the Javascript
mailing list