Nodejs Array Convert toArray()

Here you can find the source of toArray()

Method Source Code

Array.prototype.toArray = function() {
   var results = new Array(this.length);
   for (var i = 0, len = this.length; i < len; i++) {
      results[i] = this[i];//w  ww . j a  v a2  s  .  c  om
   }
   
   return results;
};

Related

  1. toArray()
    Array.prototype.toArray = function() {
      return [].concat(this);
    };
    
  2. toArray()
    Array.prototype.toArray = function() {
      return this.clone();
    };
    
  3. toArray(obj, start)
    Array.toArray = function(obj, start) {
       return Array.prototype.slice.call(obj, start); 
    };
    
  4. toArrayInt()
    Array.prototype.toArrayInt = function () {
        for (var i=0; i<this.length;i++) {
            this[i] = parseInt(this[i]);
        return this;
    };