Nodejs Utililty Methods Array Remove by Index

List of utility methods to do Array Remove by Index

Description

The list of methods to do Array Remove by Index are organized into topic(s).

Method

removeAtIndex(index)
Array.prototype.removeAtIndex = function(index) {
  this.splice(index, 1);
};
removeAtIndex(index)
Array.prototype.removeAtIndex = function(index){
  if (typeof(index) !== "number") {
    throw new Error("Input argument was not a number");
  } else if (index >= this.length || index < 0) {
    throw new Error("Input index is out of range");
  } else {
    var index = Math.floor(index);
    this.splice(index, 1);
    return this;
...
removeByIndex(i)
Array.prototype.removeByIndex = function(i) {
   return this.splice(idx, 1);
removeByIndex(index)
Array.prototype.removeByIndex = function (index) {
    var tempList = Array();
    for (var i = 0, a = 0; i < this.length; i++) {
        if (i != index) {
            tempList[a] = this[i];
            a++;
    this.setArray(tempList);
...
removeByIndex(index)
Array.prototype.removeByIndex = function(index){
  var i=0,n=0;
  for(i=0;i<this.length;i++){
    if(this[i]!=this[index]){
      this[n++]=this[i];
  if(n<i){
    this.length = n;
...
removeByIndex(index)
Array.prototype.removeByIndex = function(index){
  var i=0,n=0;
  var arrSize = this.length;
  for(i=0;i<arrSize;i++){
    if(this[i] != this[index]){
      this[n++]=this[i];
  if(n<i){
...
removeIndex(index)
Array.prototype.removeIndex = function(index) {
    if (index > -1) {
        this.splice(index, 1);
};
removeIndexAt(idx)
Array.prototype.removeIndexAt = function(idx) {
    return this.slice(0, idx).concat(this.slice(idx + 1));
};
removeIndexes(indexes)
Array.prototype.removeIndexes = function(indexes){
  for (var i = 0; i < indexes.length; i++) this.splice(indexes[i], 1);