/ Published in: JavaScript
Expand |
Embed | Plain Text
Array.prototype.clear = function( ) { this.length = 0; } var arr = [ 1, 2, 3, 4, 5 ]; arr.clear( ); arr.push( 4 ); alert( arr ); // 4
You need to login to post a comment.
Array.prototype.clear = function( ) { this.length = 0; } var arr = [ 1, 2, 3, 4, 5 ]; arr.clear( ); arr.push( 4 ); alert( arr ); // 4
You need to login to post a comment.