jQuery清除数组中的空值
作者:互联网
- var aa = ["12", "34", "", "423", " "];
- console.log($.grep(aa, function(n) {return $.trim(n).length > 0;}))
- var aaa = aa.filter(s => $.trim(s).length > 0);
- console.log(aaa);
- 结果:["12", "34", "423"]
- ["12", "34", "423"]
标签:jQuery,aa,trim,12,console,34,空值,数组,423 来源: https://www.cnblogs.com/Im-Victor/p/13441568.html