过滤掉虚假值:false, null, 0, "", undefined, NaN
JavaScript
const compact = arr => arr.filter(Boolean)
Examples
compact([0, 1, false, 2, '', 3, 'a', 'e' * 23, NaN, 's', 34])
// [ 1, 2, 3, 'a', 's', 34 ]
标签:compact,arr,false,删除,虚假,NaN,34,数组
From: https://www.cnblogs.com/sunr/p/js_array_compact.html