Node.js examples for Array:Copy
Copy array
Array.prototype.copy = function() { var copy = []; var len = this.length; // minor optimization for (var i = 0; i < len; i++) { if (this[i] instanceof Array) { copy[i] = this[i].copy();/*from w w w . ja v a 2s . c o m*/ } else { copy[i] = this[i]; } } return copy; }