Lodash _.flatten() Method
The Lodash.flatten() method is used to flatten the array to one level deep.
flatten( array )
Parameter: This method accepts single parameter array that holds simple array or array of arrays.
Return Value: The return type of this function is array.
Note: Please install lodash module by using command
npm install lodash before using the code given below.
Example 1: When 2D array of Integers is given.
Example 2: When array of arrays of object is given.
Example 3: When empty array of arrays is given.