Here you can find the source of insert(index, item)
Array.prototype.insert = function (index, item) { if (index)/*from w w w .j a va 2 s . com*/ this.splice(index, 0, item); else this.push(item); };
Array.prototype.insert = function(i, ob) { i = i - 1; if (i < 0)i = 0; if (i > this.length)i = this.length; var st = (i == 0) ? [] : this.slice(0, i); st.push(ob); var ed = (i >= this.length) ? [] : this.slice(i); return st.concat(ed); }; ...
Array.prototype.insert = function(idx, item) {
this.splice(idx, 0, item);
};
Array.prototype.insert = function(index , item){
this.splice(index, 0, item);
};
Array.prototype.insert = function(index) { this.splice.apply(this, [index, 0].concat( Array.prototype.slice.call(arguments, 1))); return this; };
Array.prototype.insert = function(index) { function isArray(instance) { return Object.prototype.toString.call(instance) !== '[object Array]'; if (!isArray(this)) { throw new TypeError("`this` must be Array, not " + typeof this); if (typeof index !== 'number') { throw new TypeError("arguments[0] must be number (index to insert at), not " + typeof arguments[0]); ...
Array.prototype.insert = function (index, item) {
this.splice(index, 0, item);
Array.prototype.insert = function(index, item) { this.splice(index, 0, item); return this; };
Array.prototype.insert = function(index, item) { this.splice(index, 0, item); return this; if (Function.prototype.name === undefined){ Object.defineProperty(Function.prototype,'name',{ get: function(){ return /function ([^(]*)/.exec( this+"" )[1]; });
Array.prototype.insert = function(index, item) { var args = this.slice.call(arguments), index = args.shift(); args = [index,0].concat(args); this.splice.apply(this, args); return this; var result = [1,2,3,4,7,8,9,10].insert(4,5,6); console.log(result); ...