Nodejs Array Append Item add(value)

Here you can find the source of add(value)

Method Source Code

"use strict";/*from w w w .  ja v  a  2s. c o m*/
Array.prototype.add = function(value) {
    this.push(value);
}

Related

  1. add(index, element)
    Array.prototype.add = function(index, element) {
      if (arguments.length == 2) {
        this.splice(index, 0, element);
      } else {
        this.push(index);
    };
    
  2. 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);
    ...
    
  3. 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;
    ...
    
  4. add(obj)
    Array.prototype.add = function (obj) {
        var i = this.length;
        this[i] = obj;
        return i;
    };
    
  5. add(other)
    Array.prototype.add = function(other) {
        console.assert(this.length == other.length, 'add: len(a) != len(b)');
        var ret = new Array(this.length);
        for(var i = 0; i < ret.length; i++)
            ret[i] = this[i] + other[i];
        return ret;