removeArrayElement = (arr, el) => {

  const index = arr.indexOf(el);
  if (index > -1) {
    return arr.splice(index, 1)[0];
  }

}
If the array contains the element, the element is removed from
the array in-place and the removed element.