We're a place where coders share, stay up-to-date and grow their careers.
Good solution, but maybe use .flat
[1,2,3,[4,5,[6,7]],8,[9,[10,11]]].flat() // [1,2,3,4,5,[6,7],8,9,[10,11]]
flat parameter is recursion level:
[1,2,3,[4,5,[6,7]],8,[9,[10,11]]].flat(2) // [1,2,3,4,5,6,7,8,9,10,11]
Thanks for reading the article and for this solution 🙌. Really appreciate it. But yeah I covered this solution because it covers recursion as well.
Good solution, but maybe use .flat
flat parameter is recursion level:
Thanks for reading the article and for this solution 🙌. Really appreciate it.
But yeah I covered this solution because it covers recursion as well.