最优:
arr.filter(Boolean)
遍历:
通过遍历判断数组, 空字符,undefined, null, false , 0转化为布尔类型都是 false来判断,或者直接判断是否=现在的格式
第三方库:
如 Lodash 库 compact方法
数组中存在undefined,0,null,false等的情况该如何去除
原文:https://www.cnblogs.com/nangras/p/15005124.html