Nodejs Array Append Item append(obj,nodup)

Here you can find the source of append(obj,nodup)

Method Source Code

/*//w w  w .  j  a  va  2 s .co m
add some useful methods to the javascript array class. All operating on the built-in Array class, so no
need for any namespacing object.

Dave Crane 2005
*/

/*
append to end of array, optionally checking for duplicates
*/
Array.prototype.append=function(obj,nodup){
  if (!(nodup && this.contains(obj))){
    this[this.length]=obj;
  }
}

Related

  1. append(array)
    Array.prototype.append = function(array)
      this.push.apply(this, array)
    
  2. append(e)
    Array.prototype.append = function(e) {
      this.push(e);
    
  3. append(from)
    Array.prototype.append=function(from) {
      this[this.length]=from;
      return this;
    
  4. append(item)
    Array.prototype.append = function(item) {
      for (let i = 0; i !== this.length; i++) {
        if (this[i] === null || this[i] === undefined) {
          this[i] = item;
          return i;
      return this.push(item) - 1;
    };
    ...
    
  5. append(item)
    Array.prototype.append = function (item) {
        this.push(item);
        return this;
    };
    
  6. appendUniqueObj(oneItem)
    Array.prototype.appendUniqueObj = function(oneItem)
      if (!this.contains(oneItem))
        this[this.length] = oneItem;
    
  7. append_all(from)
    Array.prototype.append_all=function(from) {
      for(var i=0;i<from.length;i++) {
        this.append(from[i]);
      return this;
    
  8. Append( arr )
    Array.prototype.Append = function( arr )
        for ( var i = 0; i < arr.length; i++ )
            this.push( arr[ i ] );
    };
    
  9. AddItem( item )
    Array.prototype.AddItem = function( item )
      var i = this.length ;
      this[ i ] = item ;
      return i ;