Instead of declaring a new
Array and reserving memory for it, you can reallocate an
Array previously declared.
For that, you need to remove the previous contents of the array. You can do that setting
Array.prototype.length to 0:
var array = [1, 2, 3, 4, 5] array =  // bad array.length = 0 // good!
Another good tip is to reserve the necessary memory space for your
Array by setting its
var array =  arr.length = 5 arr = 1 arr = 2 arr = 3
That useful when you want to use an
Array as temporal data buffer. array-list is a good library for that.