Skip to content

Instantly share code, notes, and snippets.

@cnjimbo
Created December 24, 2019 02:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cnjimbo/ff3df7d3767a74bacb42709c17e8469e to your computer and use it in GitHub Desktop.
Save cnjimbo/ff3df7d3767a74bacb42709c17e8469e to your computer and use it in GitHub Desktop.
Javascript: overload clean empty item of Array
//删除数组中的空元素
$.extend(Array.prototype, {
clean: function(deleteValue = "") {
for(var i = 0; i < this.length; i++) {
if(this[i] == deleteValue) {
this.splice(i, 1);
i--;
}
}
return this;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment