Javascript Array newConcat()
Array.prototype.newConcat = function () { var len = this.length; for (key in arguments) { var obj = arguments[key]; if (typeof obj === 'object') { for (let i = 0; i < obj.length; i++) { this.newConcat(obj[i]);//from www .j ava 2 s .com } } else { this[len] = obj; len++; } } return this; } var a = [0, 8]; console.log(a.newConcat(1, 2, [3, 4]));