filter(Boolean)

123 阅读1分钟

array.filter(Boolean)原来它等价于: array.filter((item) => {return Boolean(item)}) 也就是说这样写的意思就是去除数组中为“假”的元素。