Nodejs Array Clone clone()

Here you can find the source of clone()

Method Source Code

//overrite some basic array functions for this application

//http://www.ecma-international.org/ecma-262/5.1/#sec-15.4

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

var ArrayList = Array

ArrayList.prototype.indexOfEdge = function(l){
   var i = 0;//from w  w w  .  j a  va2s  .  c  o m
   var found = false;
   while(i < this.length){
      if(l == this[i].label){
         return i
      }
      i++
   }
   return -1
};

ArrayList.prototype.indexOfVertex = function(l){
   var i = 0;
   var found = false;
   while(i < this.length){
      if(l == this[i].getLabel()){
         return i
      }
      i++
   }
   return -1
};



module.exports = ArrayList

Related

  1. clone()
    Array.prototype.clone = function() {
      var clone = new Array(this.length);
      for (var i = 0; i < this.length; i++) {
        clone[i] = this[i];
      return clone;
    };
    
  2. clone()
    Array.prototype.clone = function() {
        var newArr = new Array();
        for (var i = 0; i < this.length; ++i)
            newArr.push(this[i]);
        return newArr;
    
  3. clone()
    Array.prototype.clone = function()
      var copy = new Array(this.length);
      for (var i = 0; i < this.length; i++) {
        copy[i] = this[i];
      return copy;
    
  4. clone()
    window.requestAnimFrame = (function(){
      return  window.requestAnimationFrame       ||
              window.webkitRequestAnimationFrame ||
              window.mozRequestAnimationFrame    ||
              function( callback ){
                window.setTimeout(callback, 1000 / 60); 
              };
    })();
    Array.prototype.clone = function(){
    ...
    
  5. clone()
    Array.prototype.clone = function() {
      return this.slice();
    };
    
  6. clone()
    Array.prototype.clone = function () {
        var arr = [];
        for (var i = 0, len = this.length; i < len; i++) arr[i] = this[i];
        return arr;
    
  7. clone()
    Array.prototype.clone = function() {
      return this.slice(0);
    
  8. clone()
    Array.prototype.clone = function() {
      var arr = [];
      for (var i=0;i<this.length;i++) { arr.push(this[i]); }
      return arr;
    
  9. clone()
    Array.prototype.clone = function() {
        var result = new Array(this.length);
        var i = result.length;
        while(i--) { result[i] = this[i]; }
        return result;
    };
    function appendElementsToParentSelector() {
        var i, parent;
        if(arguments[0]) {
    ...