List of utility methods to do Array Insert After
insertAfter(index, item)Array.prototype.insertAfter = function(index, item) { if (index > this.length - 1 || index < 0) { throw new Error("Index out of range"); this.splice(index + 1, 0, item); }; | |
insertAfter(o, toInsert)Array.prototype.insertAfter = function (o, toInsert) { var inserted = false; var index = this.indexOf(o); if (index == -1) { return false; else { if (index == this.length - 1) { this.push(toInsert); ... |