I work on a project with a lot of arrays and in some case I have this:
let main_array = [a,b,c,d,[e,f,g],h,i,j,[k,l,m,o],[p],q,[]]
In my main array I have a lot of subarrays, and I want to get all element from them without removing the other elements from the main array. So I want a function which can do this:
f(main_array) --> [a,b,c,d,e,f,g,h,i,j,k,l,m,o,p,q]
The particularity with the main array is about the number of arrays inside it, in fact, it could have 0 to n subarray(s) with 0 to n element(s).
Is there an existing built-in function or just a simple function with filter for example that can solve this problem in a few line of code (just 1 could be great !) ?
PS: I use node.js