Nodejs Array Clean clean()

Here you can find the source of clean()

Method Source Code

Array.prototype.clean = function() {
    var i = this.length;
    var clean = []
    while (i--) {
        this[i] = this[i].trim()//w  ww  .j  a  va  2s.c o m
        if (this[i] && this[i].length) {
            clean.push(this[i])
        }
    }
    return clean.reverse();
}

Related

  1. clean()
    Array.prototype.clean = function() {
      for(let i = 0; i < this.length; i++) {
        if(this[i] === "") {
          this.splice(i, 1);
      return this;
    };
    
  2. clean()
    Array.prototype.clean = function() {
        for(var i = 0; i < this.length; i++) {
            if(this[i] === "") {
                this.splice(i, 1);
        return this;
    };
    
  3. clean()
    Array.prototype.clean = function() {
      return this.filter(function(a) { 
        return a;
      });
    
  4. clean(deleteValue)
    Array.prototype.clean = function(deleteValue) {
      for (var i = 0; i < this.length; i++) {
        if (this[i] == deleteValue) {
          this.splice(i, 1);
          i--;
      return this;
    };
    ...
    
  5. clean(deleteValue)
    Array.prototype.clean = function(deleteValue) {
      for (var i = 0; i < this.length; i++) {
        if (this[i] === deleteValue) {         
          this.splice(i, 1);
          i--;
      return this;
    };
    ...
    
  6. clean(deleteValue)
    'use strict';
    Array.prototype.clean = Array.prototype.clean || function(deleteValue) {
      for (var i = 0; i < this.length; i++) {
        if (this[i] == deleteValue) {         
          this.splice(i, 1);
          i--;
      return this;
    ...