Nodejs Array Clone Clone()

Here you can find the source of Clone()

Method Source Code

Array.prototype.Clone = function()
{
    var n = [];// w  ww .  j  av a 2 s. c  o m
    
    var s = this.constructor;
    for ( var i in this )
        if ( !s[ i ] )
        {
            if ( this[ i ] != null && typeof this[ i ] == typeof [] )
                n[ i ] = this[ i ].Clone();
            else n[ i ] = this[ i ];
        }
    
    return n;
};

Related

  1. clone()
    Array.prototype.clone = function() {
      return this.concat();
    
  2. clone()
    Array.prototype.clone = function() {
      var clone = [];
      for (var i = 0; i < this.length; i++) {
        clone.push(this[i]);
      return clone;
    };
    
  3. clone()
    Array.prototype.clone = function(){
      var ret = new Array(this.length);
      for(var i=0;i<this.length;i++){
        if(this[i].constructor==Array){
          ret[i]=this[i].clone();
        }else{
          ret[i]=this[i];
      return ret;
    
  4. clone(deep)
    'use strict';
    function clone_array(src, deep) {
      var result = [];
      var i, l = src.length;
      for (i = 0; i < l; i++) {
        if (deep)
          result.push(clone(src[i], deep));
        else
          result.push(src[i]);
    ...
    
  5. cloneReserva()
    Array.prototype.cloneReserva = function() {
       var arr = [];
       for(var i = 0; i < this.length ; i++){
           obj = {
             reservaId   : this[i].reservaId,      
              color       : this[i].color, 
              timeStart   : new Date(this[i].timeStart),  
              timeEnd     : new Date(this[i].timeEnd),  
              reservedBy  : this[i].reservedBy, 
    ...
    
  6. _clone()
    Array.prototype._clone = function() {
        var ar = [];
        for(var i = 0; i < this.length; i++) {
            ar.push(this[i]);
        return ar;
    
  7. deepClone()
    Array.prototype.deepClone = function () {
      return JSON.parse(JSON.stringify(this));
    };
    
  8. Int8Array clone
    (function(global){ "use strict";
    Int8Array.prototype.clone =
    Uint8Array.prototype.clone =
    Uint8ClampedArray.prototype.clone =
    Int16Array.prototype.clone =
    Uint16Array.prototype.clone =
    Int32Array.prototype.clone =
    Uint32Array.prototype.copy =
    Float32Array.prototype.clone =
    ...