Posted By

szsk on 08/02/06


Tagged

javascript array


Versions (?)

array_clear


 / Published in: JavaScript
 

  1. Array.prototype.clear = function( ) {
  2. this.length = 0;
  3. }
  4.  
  5. var arr = [ 1, 2, 3, 4, 5 ];
  6. arr.clear( );
  7. arr.push( 4 );
  8. alert( arr ); // 4

Report this snippet  

You need to login to post a comment.