As stated Here, It seems that the most efficient way to empty an existing array (and NOT to allocate a new one) in javascript is to use:
array.length = 0;
Does the same operation work for plain objects? (aka "associative arrays" or "dictionaries") If not, what is the most efficient way to empty an existing javascript object?
I think that allocating a new one is not the best option, since it will push some extra work to the garbage collector, and will allocate some new memory on the heap, but I might be wrong.
I need a solution that works at least with Chrome and Firefox.