JS: Array.prototype.push

By Xah Lee. Date: . Last updated: .
xArray.push(new1, new2, etc)
  • Adds items to the end of the array.
  • Return the new length.
const xx = [3];
const yy = xx.push(7, [8]);
console.log(yy === 3);
console.log(JSON.stringify(xx) === "[3,7,[8]]");

JavaScript. Array Push Pop