Nodejs Array Push push()

Here you can find the source of push()

Method Source Code

// @if false/*w  w w  .j a  v  a2  s .  c  o  m*/
if (!Array.prototype.push) {
Array.prototype.push = function () {
    var i, iLen;
    for (i = 0, iLen = arguments.length; i < iLen; ++i) {
        this[this.length] = arguments[i];
    }
};
}
// @endif

Related

  1. push()
    var a = ['a', 'b', 'c'];
    var b = ['x', 'y', 'z'];
    var c = a.push(b, true);
    console.log("a : " + a); 
    console.log("c : " + c); 
    Array.prototype.push = function () {
        this.splice.apply(
            this,
            [this.length, 0].concat(Array.prototype.slice.apply(arguments))
    ...
    
  2. push()
    Array.prototype.push = function () {
      for (var i=0; i<arguments.length; i++)
        this[this.length] = arguments[i];
      return this.length;
    
  3. push()
    Array.prototype.push = function()
      for (var i = 0; i < arguments.length; i++)
        this[this.length] = arguments[i];
      return arguments[i - 1];
    };
    
  4. push(data)
    Array.prototype.push = function(data) {
      this[this.length] = data;
      return this.length;
    };