How about this one liner code?
[ ['dog','cat', ['chicken', 'bear'] ],[['mouse','horse'],'lion'] ].join().split(',')
basically join will split the comma string from the nested array, and with split you can get a 1d array, okay? bonus it will work on all major browsers :)
therefore the output will be: -
["dog", "cat", "chicken", "bear", "mouse", "horse", "lion"]
vipin goyal
source share