If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Which what to best re-initialize or clear an array?

In the following demo only script, I clear (reset) the "tarr" two different ways.
My questions are:
1. Is one way better than the other? More acceptable? Or are they both the same?
2. Is there a concern with "memory leakage" using either method?

You pose an interesting question. I had no idea as to the answer, and I might not still. But I did conduct a speed test about 20 or so times, and it appears that assigning the variable to an empty array is significantly faster than setting the length property to zero. I ran the program using node,js which uses Chrome's javascript engine It may be however that you will get wildly different results with different js engines.