Nodejs Array Clone clone()

Here you can find the source of clone()

Method Source Code

/**//from ww  w. j  a  v a 2s .  c  om
 * Array#clone() -> Array
 *
 * Returns a clone of an array
 *
 **/
Array.prototype.clone = function() {
  return this.concat();
}

Related

  1. clone()
    Array.prototype.clone = function(){
        if ( this[0].constructor == Array ) {
            var ar, n;
            ar = new Array( this.length );
            for ( n = 0; n < ar.length; n++ ) {
                ar[n] = this[n].clone();
            return ar;
        return Array.apply( null, this );
    
  2. clone()
    Array.prototype.clone = function(){
      var ret = [];
      for (var i=0;i<this.length;i++){
        ret[i] = this[i];
      return ret;
    };
    
  3. clone()
    Array.prototype.clone = function() {
      var newArray = [];
      for (var i = 0; i < this.length; i++) {
        if (typeof(this[i]) == 'object' || typeof(this[i]) == 'function') {
          newArray[i] = this[i].clone();
        } else {
          newArray[i] = this[i];
      return newArray;
    };
    
  4. clone()
    Array.prototype.clone = function () {
        return this.slice(0);
    };
    
  5. clone()
    Array.prototype.clone = function () {
      var a = new Array(); 
      for (var property in this) {
        a[property] = typeof (this[property]) == 'object' ? this[property].clone() : this[property]
      return a
    
  6. clone()
    Array.prototype.clone = function() {
      var clone = [];
      for (var i = 0; i < this.length; i++) {
        clone.push(this[i]);
      return clone;
    };
    
  7. 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;
    
  8. 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]);
    ...
    
  9. 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, 
    ...