Nodejs Array Remove by Value removeOne(el)

Here you can find the source of removeOne(el)

Method Source Code

Array.prototype.removeOne = function (el) {
    var index = this.indexOf(el);
    if (index != -1) {
        this.splice(index, 1);/*from  w  w  w.j a  v a2  s .  c  om*/
        return true;
    }
};

Related

  1. removeId(obj)
    Array.prototype.removeId = function(obj) {
      for(var i = 0; i < this.length; i++){
        if(this[i].toString() === obj.toString()){
          this.splice(i, 1);
      return this;
    };
    
  2. removeItem(obj)
    Array.prototype.removeItem = function(obj) {
        var index = this.indexOf(obj);
        if (-1 === index)return;
        this.splice(index, 1);
    };
    
  3. removeItemByID(element)
    Array.prototype.removeItemByID = function(element)
        var found;
        for (var i = 0; i < this.length; i++)
            if (this[i].id == element.id)
                found = this[i];
                break;
    ...
    
  4. removeItems(value)
    Array.prototype.removeItems = function(value) {
        return this.filter(filterInput);
        function filterInput(v) {
            return v != value;
    var arr = [1, 2, 1, 4, 1, 3, 4, 1, 111, 3, 2, 1, '1'];
    console.log(arr.removeItems(1));
    var arr = ['hi', 'bye', 'hello' ];
    ...
    
  5. removeItemsByValue(value)
    Array.prototype.removeItemsByValue =  function(value){
        for(var i = 0 ; i < this.length ; i++){
            if(this[i] == value ){
                this.splice(i,1);
        return this;
    var a = [1,2,3,4,1,2,"1",5,1];
    ...
    
  6. removeOneByValue(v)
    Array.prototype.removeOneByValue = function(v) {
        for (let i = this.length - 1; i >= 0; i--)
            if (this[i] === v)
                return this.splice(i, 1);
        return this;
    };
    
  7. removeData(oneItem)
    Array.prototype.removeData = function(oneItem)
      var index = dojo.indexOf(this, oneItem);
      if (index != -1)
        return this.splice(index, 1);
      return this;
    
  8. removeEle(ele)
    Array.prototype.removeEle = function(ele){
        var arr = this;
        console.log(arr);
        console.log(ele)
        this.pop(ele);
        return arr;
    
  9. removeElement(param)
    Array.prototype.removeElement = function (param) {
        for(var i = this.length; i--;){
            if (this[i] === param) this.splice(i, 1);
    var arr = [3,5,3,22,663,11,8,3];
    arr.removeElement(3);
    console.log(arr);