Nodejs Array Append Item add(a2)

Here you can find the source of add(a2)

Method Source Code

Array.prototype.add = function(a2) {
  var l1 = this.length;
  var l2 = a2.length;
  var len = (l1 < l2 ? l1 : l2);
  var result = new Array(len);

  for (var i = 0; i < len; i++) {
    result[i] = this[i] + a2[i];/*  w w w .  j  av a2  s .co m*/
  }
  return result;
}

Related

  1. append(obj,nodup)
    Array.prototype.append=function(obj,nodup){
      if (!(nodup && this.contains(obj))){
        this[this.length]=obj;
    
  2. appendUniqueObj(oneItem)
    Array.prototype.appendUniqueObj = function(oneItem)
      if (!this.contains(oneItem))
        this[this.length] = oneItem;
    
  3. append_all(from)
    Array.prototype.append_all=function(from) {
      for(var i=0;i<from.length;i++) {
        this.append(from[i]);
      return this;
    
  4. Append( arr )
    Array.prototype.Append = function( arr )
        for ( var i = 0; i < arr.length; i++ )
            this.push( arr[ i ] );
    };
    
  5. AddItem( item )
    Array.prototype.AddItem = function( item )
      var i = this.length ;
      this[ i ] = item ;
      return i ;
    
  6. add(e)
    Array.prototype.add = function (e) {
        this.push(e);
    };
    
  7. add(el)
    Array.prototype.add = function(el) {
      this.push(el);
      return this;
    };
    
  8. add(el)
    Array.prototype.add = function (el) {
        var index = this.indexOf(el);
        if (index == -1) {
            this.push(el);
    };
    Array.prototype.remove = function (el) {
        var index = this.indexOf(el);
        if (index > -1) {
    ...
    
  9. add(element)
    Array.prototype.add = function(element) {
      var newSize = this.push(element);
      return newSize-1;