Javascript Array removeEmpty()

Description

Javascript Array removeEmpty()



Array.prototype.removeEmpty = function () {
  for (var i = 0; i < this.length; ++i) {
    if (this[i].replace(/^\s*$/, "") === "") {
      this.splice(i--, 1);// www. jav a  2s  . com
    }
  }
  return this;
};



PreviousNext

Related