Nodejs Array Append Item add(element)

Here you can find the source of add(element)

Method Source Code

/**//w  w  w . j a va  2 s.  c  o  m
 * Adds the element to the array.
 *
 * @param element the element to add.
 * @return the index of the element.
 */
Array.prototype.add = function(element) {
  var newSize = this.push(element);

  return newSize-1;
}

Related

  1. AddItem( item )
    Array.prototype.AddItem = function( item )
      var i = this.length ;
      this[ i ] = item ;
      return i ;
    
  2. add(a2)
    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];
      return result;
    ...
    
  3. add(e)
    Array.prototype.add = function (e) {
        this.push(e);
    };
    
  4. add(el)
    Array.prototype.add = function(el) {
      this.push(el);
      return this;
    };
    
  5. 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) {
    ...
    
  6. add(elemento,duplicado)
    Array.prototype.add = function(elemento,duplicado) {
      if(duplicado===false){
        for (var i = 0; i < this.length; i++) {
          if(this[i]===elemento)
            return;
      this[this.length] = elemento;
    
  7. add(index, element)
    Array.prototype.add = function(index, element) {
      if (arguments.length == 2) {
        this.splice(index, 0, element);
      } else {
        this.push(index);
    };
    
  8. add(index, item)
    Array.prototype.add = function(index, item){
      if (item === undefined){
        item = index;
        index = 0;
      while (index > this.length){
        this.push(undefined);
      this.splice(index, 0, item);
    ...
    
  9. add(item)
    var SEP = ',';
    Array.prototype.add = function(item) {
        for ( var i = 0; i < this.length; i++) {
            if (this[i] === item) {
                return this;
        this[this.length] = item;
        return this;
    ...