Skip to content

flatten ​

js
_.flatten(array)

将 array 展平为单层深度。

¥Flattens array a single level deep.

新增于 ​

¥Since

0.1.0

参数 ​

¥Arguments

  1. array (数组):要展平的数组。

    ¥array (Array): The array to flatten.

返回 ​

¥Returns

(数组):返回新的扁平化数组。

¥(Array): Returns the new flattened array.

示例 ​

¥Example

js
_.flatten([1, [2, [3, [4]], 5]]);
// => [1, 2, [3, [4]], 5]

Lodash v4.17 中文网 - 粤ICP备13048890号