Lodash – flatten method

  • Post author:
  • Post category:Lodash
  • Post comments:2 Comments
Lodash - flatten method

Syntax Of Lodash flatten method

var _ = require('lodash');
var list = [1, [2], [4], 5, [[6]]];
var result = _.flatten(list)

console.log(result);

We will discuss Lodash flatten method in this flattens array a single level deep.

Arguments

  • array (Array) − The array to flatten.

Output

  • (Array) − Returns the new flattened array.

Next Topic – Click Here

This Post Has 2 Comments

Leave a Reply