Nodejs Array Clone clone()

Here you can find the source of clone()

Method Source Code

/**//  w  ww  .j  a  va2 s.  c om
 * Sets up a clone method on the Array prototype
 */

Array.prototype.clone = function() {
    return this.slice();  
};

Related

  1. clone()
    Array.prototype.clone = function() {
      return this.slice(0);
    };
    
  2. clone()
    Array.prototype.clone = function () {
      var newArray = new Array();
      for(var index=0; index<this.length;index=index+1) {
        newArray[index] = this[index];
      return newArray;
    };
    
  3. clone()
    var utils = {
      extend: function(orig, extra) {
        return Object.keys(extra).forEach(function(key) {
          orig[key] = extra[key];
        });
    };
    Array.prototype.clone = function() {
      return this.slice(0);
    ...
    
  4. clone()
    Array.prototype.clone = function() {
        var arr = this.slice(0);
        for( var i = 0; i < this.length; i++ ) {
            if( this[i].clone ) {
                arr[i] = this[i].clone();
        return arr;
    
  5. clone()
    Array.prototype.clone = function() {
        var arr = this.slice(0);
        for( var i = 0; i < this.length; i++ ) {
            if( this[i].clone ) {
                arr[i] = this[i].clone();
        return arr;