arrays.js
function giveBack(array) {

  // Don't return arrays that didn't originate from this pool
  if (!array.hasOwnProperty('originalLength')) return;

  // Reset all the elements
  for (var i = array.length; i--;) {
    array[i] = undefined;
  }

  // Reset the length
  array.length = array.originalLength;

  // Remove custom properties that the Matrix class might have added
  delete array.rows;
  delete array.cols;

  // Let the pool know that it's no longer in use
  array.inUse = false;
}
function giveBack(array) {

  // Don't return arrays that didn't originate from this pool
  if (!array.hasOwnProperty('originalLength')) return;

  // Reset all the elements
  for (var i = array.length; i--;) {
    array[i] = undefined;
  }

  // Reset the length
  array.length = array.originalLength;

  // Remove custom properties that the Matrix class might have added
  delete array.rows;
  delete array.cols;

  // Let the pool know that it's no longer in use
  array.inUse = false;
}
function giveBack ( array ) { // Don't return arrays that didn't originate from this pool if ( ! array . hasOwnProperty ( 'originalLength' ) ) return ; // Reset all the elements for ( var i = array . length ; i -- ; ) { array [ i ] = undefined ; } // Reset the length array . length = array . originalLength ; // Remove custom properties that the Matrix class might have added delete array . rows ; delete array . cols ; // Let the pool know that it's no longer in use array . inUse = false ; }
Give back an array to the pool.
This will reset the array to the original length and make all values
undefined.

@param {Array} array An array that was gotten from this pool before.
Give back an array to the pool . This will reset the array to the original length and make all values undefined .