Javascript Array append(ar)
Array.prototype.append = function(ar) { this.length += ar.length; for (var i = 0, len = this.length, len2 = ar.length; i < len2; i++) { this[len + i] = ar[i];//ww w .j a v a 2 s. co m } };
Array.prototype.append = function(array) { this.push.apply(this, array)/*from www . j ava 2s.c om*/ }
function print(s) { console.log(s);/*from w w w .j a v a2 s . c o m*/ } function println(s) { console.log(s); } Array.prototype.append = function(e) { this.push(e); }
Array.prototype.append = function(item) { for (let i = 0; i !== this.length; i++) { if (this[i] === null || this[i] === undefined) { this[i] = item;//w w w.ja v a2s. c om return i; } } return this.push(item) - 1; };