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