Here you can find the source of insert(value)
Array.prototype.insert = function(value) { if(this.root == null) { this.root[1] = value; /*from w w w.j a va2 s . com*/ } } var heap = []; heap.insert(30); console.log(heap);
Array.prototype.insert = function(index, item) { index = Math.min(index, this.length); arguments.length > 1 && this.splice.apply(this, [index, 0].concat([].pop.call(arguments))) && this.insert.apply(this, arguments); return this;
Array.prototype.insert = function(index, value) if(index >= 0) var a = this.slice(), b = a.splice(index); a[index] = value; return a.concat(b); }; ...
Array.prototype.insert = function (index, value) {
this.splice(index, 0, value);
};
Array.prototype.insert = function(object) { this[this.length] = object; return this;
Array.prototype.insert = function(p_index, newObj){ var l = this.length; var precObj = null; for(var i=0; i<l; i++){ if(precObj != null){ var obj = precObj; precObj = this[i]; this[i] = obj; }else if(i == p_index){ ...