Skip to content
On this page

Compact 函数

过滤数组中的 falsy 值, 0, '', null, undefined, false, NaN

Code

const compact = (arary) => arary.filter((item) => item);