Skip to content
Advertisement

Is there a way to execute .map recursively for every array in an array in JavaScript/TypeScript?

I currently have this array which repeats recursively:

JavaScript

To get the structure I want I currently have this:

JavaScript

Is there a way to repeat my initial array.map recursively for each child array?

Advertisement

Answer

One possible solution, based on the output I believe you want:

JavaScript

Or as suggested below, use shortands:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement