Here you can find the source of copy()
// return array of length n with all elements initialized to e // from Crockford, JavaScript: The Good Parts Array.dim = function (n, e) { var a = [], i; for (i = 0; i < n; i += 1) { a[i] = e;//from ww w. ja va 2 s .c o m } return a; } Array.prototype.copy = function () { return this.slice(0); } Array.prototype.isEmpty = function () { return (this.length === 0); }
Array.prototype.copy = (function () { var f = function (o) { return o; }; return function () { return this.map(f); }; }());
Array.prototype.copy = function(){ var tmp = []; for (var i = 0; i < this.length; i++) tmp.push(this[i]); return tmp;
Array.prototype.copy = function(){ return this.filter(function(){return true;}); };
Array.prototype.copy = function () { return this.slice(0);
Array.prototype.copy = function() { var copy = []; this.forEach(function(element) { copy.push(element); }); return copy; };
Array.prototype.copy = function() { var rst = []; for (var i = 0; i < this.length; ++i) rst.push(this[i]); return rst;