remove an empty string from array of strings - JQuery

后端 未结 5 1753
无人及你
无人及你 2020-12-13 18:00

I have an array [\"Lorem\", \"\", \"ipsum\"]. I would like to remove the empty string from this array and get [\"Lorem\", \"ipsum\"].

Is th

5条回答
  •  孤街浪徒
    2020-12-13 18:44

    var arr = [ a, b, c, , e, f, , g, h ];

    arr = jQuery.grep(arr, function(n){ return (n); });

    arr is now [ a, b, c, d, e, f, g];

提交回复
热议问题