I have a deep array, hence the array with arrays children like below:
const deepArray = ['1',[['a'],['b']],[2],[[[['4',[3,'c']]]],[5]]];
I wanna set all end children in a flat array, I use spread operator
of ES6
but it spread shallow, I have no idea to how to make them to below:
const shallowArray = ['1','a','b',2,'4',3,'c',5];
Maybe a recursive function can do it but how? it should be very optimized because I wanna use it in a react native
project. I'm worried about crash so I'm very cautious about optimization.