Nodejs Array Append Item append(item)

Here you can find the source of append(item)

Method Source Code

Array.prototype.append = function(item) {
   for (let i = 0; i !== this.length; i++) {
      if (this[i] === null || this[i] === undefined) {
         this[i] = item;/*w  w  w  .j a v  a  2 s. co m*/
         return i;
      }
   }
   return this.push(item) - 1;
};

Related

  1. append(ar)
    Array.prototype.append = function(ar) {
      this.length += ar.length;
      for (var i = 0, len = this.length, len2 = ar.length; i < len2; i++) {
        this[len + i] = ar[i];
    };
    
  2. append(arr)
    Array.prototype.append = function (arr) {
        if (arr) {
            for (var i = 0; i < arr.length; i++) {
                this.push(arr[i]);
        return this;
    };
    
  3. append(array)
    Array.prototype.append = function(array)
      this.push.apply(this, array)
    
  4. append(e)
    Array.prototype.append = function(e) {
      this.push(e);
    
  5. append(from)
    Array.prototype.append=function(from) {
      this[this.length]=from;
      return this;
    
  6. append(item)
    Array.prototype.append = function (item) {
        this.push(item);
        return this;
    };
    
  7. append(obj,nodup)
    Array.prototype.append=function(obj,nodup){
      if (!(nodup && this.contains(obj))){
        this[this.length]=obj;
    
  8. appendUniqueObj(oneItem)
    Array.prototype.appendUniqueObj = function(oneItem)
      if (!this.contains(oneItem))
        this[this.length] = oneItem;
    
  9. append_all(from)
    Array.prototype.append_all=function(from) {
      for(var i=0;i<from.length;i++) {
        this.append(from[i]);
      return this;