用AI赚第一桶💰低成本搭建一套AI赚钱工具,源码可二开。 广告
## compact + [link](./compact "Link to this entry.") + [source](https://github.com/lodash/lodash/blob/4.5.0正式版/lodash.src.js#L5539 "View in source.") + [npm](https://www.npmjs.com/package/lodash.compact "See the npm package.") ``` _.compact(array) ``` 创建一个移除了所有假值的数组。例如:`false`、`null`、 `0`、`""`、`undefined`, 以及`NaN` 都是 “假值”. ### 参数 1. array (Array) 需要被处理的数组。 ### 返回值 (Array) 返回移除了假值的数组。 ### 示例 ``` _.compact([0, 1, false, 2, '', 3]); // => [1, 2, 3] ```