push()adds one or more elements at the end arrayand returns a new lengtharray. You can use the array property lengthto add an element to the end.
if (!Array.prototype.push) {
Array.prototype.push = function() {
for (var i = 0; i < arguments.length; i++) {
this[this.length] = arguments[i];
}
return this.length;
};
}
source
share