JSFiddle - React, Tailwind, and code Playground

by mtenschert

JavaScript

Array.prototype.remove = function(elem) {
  var indexElement = this.findIndex(el => el === elem);
  if (indexElement != -1)
    this.splice(indexElement, 1);
  return this;
};

// Test remove
var myArr = ['A', 'B', 'C'];
myArr.remove('A');
alert(myArr);