I was reading ruby's array flatten function and looking for similar function in Javascript and didn't found. So, I created it myself.
Input: [[1,2,[3]],4]
Output : [1,2,3,4]
If you want to use reduce/concate methods you will not get desired answer for multi dimensional array.
What can be the solution code you think ?!!!