Chrome Extension

Merge multiple arrays and strings into single array using Lodash

If you want to merge or combine multiple arrays, string, numbers into a single array using lodash then you can use its _.concat() method.
const str = 50;
const arr1 = [20];
const arr2 = [30, 35];
const arr3 = [[10]]

const final_arr = _.concat(str, arr1, arr2, arr3);
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place. Check how cool is the tool

The _.concat() method takes all the arrays and other items as parameter and combine them together to generate a final array.

Live Demo

Search Index Data (The code snippet can also be found with below search text)

_.concat lodash
Was this helpful?